[FrameworkBundle] Validator cache fails with annotations#21102
Closed
mpajunen wants to merge 2 commits intosymfony:3.2from
Closed
[FrameworkBundle] Validator cache fails with annotations#21102mpajunen wants to merge 2 commits intosymfony:3.2from
mpajunen wants to merge 2 commits intosymfony:3.2from
Conversation
Member
Contributor
Author
|
(Whoops, didn't think to look for an open PR that far back since our problem only happens with 3.2.1.) Just by looking at the changes in #20793 it will highly likely solve the error situation since it includes basically the same fix as this PR. The main problem most likely remains however. The 3.2.1 autoloader will still throw |
Contributor
Author
|
Created a branch to check #20793 with the new test case from this PR: https://github.com/mpajunen/symfony/tree/validator-warmup-with-20793 Test still fails as expected. And no, my smaller fix probably does nothing for the earlier issue that #20793 is meant to fix. |
Member
fabpot
added a commit
that referenced
this pull request
Jan 12, 2017
…pter-related cache warmers (nicolas-grekas, mpajunen) This PR was merged into the 3.2 branch. Discussion ---------- [FrameworkBundle] Fix class_exists() checks in PhpArrayAdapter-related cache warmers | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Follow up of #21102 Commits ------- e09dccc [FrameworkBundle] Add annotated validator cache test case c60009e [FrameworkBundle] Fix class_exists() checks in PhpArrayAdapter-related cache warmers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validation cache warmup can fail if the validated classes contain annotations that use constants.
The cause is the autoloader introduced in #20830. Using another autoloader in addition to the default composer one changes the behavior of the annotation reader:
DocParsermay check for constants in undefined classes. With the new autoloader that check causes a\ReflectionExceptionand caching that class fails.This can also cause an error in
LazyLoadingMetadataFactory: If loading a class fails, valuefalsemay remain in theloadedClassesproperty. If that class is a parent of another validated class, merging the parent constraints will now fail.This PR currently includes a fix for the second problem: Invalid state in
LazyLoadingMetadataFactoryis no longer possible. This gets rid of the error, but the cache is still not built correctly as demonstrated by the failing test case. I'm not quite sure how to fix this correctly.Ping @nicolas-grekas
There are still problems to solve: