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

[PhpUnitBridge] SYMFONY_DEPRECATIONS_HELPER and DeprecationErrorHandler #38239

Copy link
Copy link
Closed
@shehi

Description

@shehi
Issue body actions

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:

image

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:

image

How to reproduce

  1. phpunit.xml file has line: <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
  2. Create some test with deprecated usage triggerable.
  3. Run tests and you still will get THE ERROR HANDLER HAS CHANGED! error at the end of the test, which is emitted by DeprecationErrorHandler.
    image
  4. Run the same tests with env variable passed in command shell: SYMFONY_DEPRECATIONS_HELPER="disabled" phpunit and no errors will be emitted.
    image

And guys... All caps?! Seriously?!

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.