Skip to content

[Routing] Route::$env not initialized PHP 8 #45802

@ricohumme

Description

@ricohumme

Symfony version(s) affected

6.0.5

Description

When using this branch I can see that some variables are not initialized when the cache is cleared.
I did however see that these class variables are present (but not all initialized) in the 5.4 branch.
In the 6.0 and 6.1 branch, the class variables are no longer present.

The specific error I got

In Route.php line 196:
                                                                                                              
  Typed property Symfony\Component\Routing\Annotation\Route::$env must not be accessed before initialization  
                                                                                                              

How to reproduce

Checkout latest version of symfony/routing and run this with PHP 8 with strict variables.

Possible Solution

Add the class variables and initialize these

Additional Context

No response

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