You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AnnotationFileLoader interprets ClassName::class syntax as start of class definition and treats next token (if it's a string) as a class name.
Example:
trait Foo
{
publicfunctiondoBar()
{
$baz = self::class; // this is parsed as a beginning of class definitionif (true) {
}
}
}
AnnotationFileLoader will find "true" as a name of a class in that file.
This will result in "Class true does not exist" exception thrown from \Symfony\Component\Routing\Loader\AnnotationClassLoader::load.
The text was updated successfully, but these errors were encountered:
…t as a beginning of a class name (jakzal, nicolas-grekas)
This PR was merged into the 2.3 branch.
Discussion
----------
[Routing] Fix the annotation loader taking a class constant as a beginning of a class name
| Q | A
| ------------- | ---
| Branch? | 2.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #18633
| License | MIT
| Doc PR | -
Code copy/pasted from ClassMapGenerator.php
Commits
-------
8d4f35d [Routing] Finish annotation loader taking a class constant as a beginning of a class name
43c7f9b [Routing] Fix the annotation loader taking a class constant as a beginning of a class name
Uh oh!
There was an error while loading. Please reload this page.
The
AnnotationFileLoader
interpretsClassName::class
syntax as start of class definition and treats next token (if it's a string) as a class name.Example:
AnnotationFileLoader
will find "true" as a name of a class in that file.This will result in "Class true does not exist" exception thrown from
\Symfony\Component\Routing\Loader\AnnotationClassLoader::load
.The text was updated successfully, but these errors were encountered: