Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Routing] AnnotationFileLoader throws exception when parsing non-class files that contain "::class" syntax #18633

Copy link
Copy link
Closed
@mkruk-u2

Description

@mkruk-u2
Issue body actions

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
{
    public function doBar()
    {
        $baz = self::class;  // this is parsed as a beginning of class definition
        if (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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.