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

Not meaningful exception for syntax error #35602

Copy link
Copy link
Closed
@Heyfara

Description

@Heyfara
Issue body actions

Symfony version(s) affected: 4.4

Description
Until Symfony 4.4, when making a syntax error in a file, you would get a ParseError. But since 4.4, you get a LoaderLoadException saying :
Expected to find class "App/Controller/Controller" in file "/src/Controller/Controller.php" while importing services from resource "../src/*", but it was not found! Check the namespace prefix used with the resource in /config/services.yaml (which is loaded in resource "/config/services.yaml").

The message isn't very helpful. We can only know there is something wrong somewhere in the given class. As a developper, I would expect a meaningful exception message, just like in previous versions. I couldn't test this on version 5 though.

How to reproduce

  • Create a new project using latest 4.4 version
  • Create a simple controller class. Example here.
  • Make a syntax error : remove a semicolon, or omit a dollar sign in front of a variable name.
  • Referesh the page.
  • You should see the exception.

Additional context
Seems to affect autowired classes. If you make a syntax error in the Kernel.php file, the exception is a ParseError as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.