Closed
Description
Symfony version(s) affected: 5.1.5
Description
This line, where DeprecationErrorHandler
is being registered, relies on the fact that a SYMFONY_DEPRECATIONS_HELPER
env value exists in $_ENV. Problem is, this bootstrapping happens while inside Composer autoloader:
At this point, phpunit.xml
file hasn't even been loaded, as a result, the aforementioned env value which is provided there isn't put into $_ENV yet. This technically invalidates the point of this line in the code if you don't provide the env value via command shell.
Once autoloader is loaded (at this point we are past the point of loading DeprecationErrorHandler
) env values are loaded from phpunit.xml
:
How to reproduce
phpunit.xml
file has line:<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
- Create some test with deprecated usage triggerable.
- Run tests and you still will get
THE ERROR HANDLER HAS CHANGED!
error at the end of the test, which is emitted byDeprecationErrorHandler
.
- Run the same tests with env variable passed in command shell:
SYMFONY_DEPRECATIONS_HELPER="disabled" phpunit
and no errors will be emitted.
And guys... All caps?! Seriously?!
Metadata
Metadata
Assignees
Labels
Issues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.