Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle][Config] Ignore exceptions thrown during reflection classes autoload#32516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedJul 12, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm not sure we need to work around since the new behavior has been reverted on <7.4 |
nicolas-grekas commentedJul 12, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmm, this is different and discussed inhttps://bugs.php.net/74372 |
nikic commentedJul 12, 2019
@nicolas-grekas I don't think introducing an Error/Exception distinction here makes sense. If you want to ignore exceptions, please ignore them explicitly. We could revert from 7.3 and introduce in a later version, but given that we're at 7.3.8 already and this change is explicitly called out in the migration guide, I'm not sure doing that is a good idea. You'll have to deal with it at some point in either case... |
nicolas-grekas commentedJul 12, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@nikic thanks for the feedback, OK. @fancyweb --- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php+++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php@@ -76,11 +76,12 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ try { $exists = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false);- } catch (\ReflectionException $e) {+ } catch (\Throwable $e) { if (0 >= $timestamp) { unset(self::$existsCache[1][$this->resource]); throw $e; }+ $exists = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false); } finally { self::$autoloadedClass = $autoloadedClass; if (!--self::$autoloadLevel) {
|
nicolas-grekas commentedJul 12, 2019
OK, I missed the |
2f420b6 to0816b13Comparefancyweb commentedJul 12, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@nicolas-grekas Just pushed all tests + a deduplication of the code. I don't think it was what you wanted so I'm waiting for your feedback 😁 |
nicolas-grekas commentedJul 15, 2019
|
63bbf4c to2f39c7eComparefancyweb commentedJul 16, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Done.
Actually this method was introduced directly as |
| $reader->getMethodAnnotations($reflectionMethod); | ||
| try { | ||
| $reader->getMethodAnnotations($reflectionMethod); | ||
| }catch (AnnotationException$e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is another fix / improvement. Moving this catch on every calls allows to not fail totally on first fail but just on each failing cases.
Uh oh!
There was an error while loading.Please reload this page.
f609060 to1782e42CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
9f23898 to5df2cebCompareef3229e tod13f943Comparefd5bc1e toccf2004Compareccf2004 tobf467ccComparebf467cc to1f06925Compare1f06925 todbd9b75Comparenicolas-grekas commentedAug 7, 2019
Thank you@fancyweb. |
…reflection classes autoload (fancyweb)This PR was merged into the 3.4 branch.Discussion----------[FrameworkBundle][Config] Ignore exceptions thrown during reflection classes autoload| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#32499 with PHP 7.3+| License | MIT| Doc PR | -The behavior when an exception is thrown in a class loader changed in PHP 7.3 (cfhttps://3v4l.org/OQPk9). That means that the `throwOnRequiredClass` trick that is done in the parent class of these cache warmers (`AbstractPhpFileCacheWarmer`) does not work anymore with PHP7.3+.Commits-------dbd9b75 [FrameworkBundle][Config] Ignore exeptions thrown during reflection classes autoload
The behavior when an exception is thrown in a class loader changed in PHP 7.3 (cfhttps://3v4l.org/OQPk9). That means that the
throwOnRequiredClasstrick that is done in the parent class of these cache warmers (AbstractPhpFileCacheWarmer) does not work anymore with PHP7.3+.