-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PhpUnitBridge] SYMFONY_DEPRECATIONS_HELPER and DeprecationErrorHandler #38239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
My
|
Could you please make a repo with the reproducer? That would help us get quickly to running into the issue locally. |
Hey @nicolas-grekas , At the moment I am quite filled with various projects, work and open-source of my own. That might be a bit difficult to spend a time on this one, otherwise I'd have rather worked on PR. |
Related issues
ReproducerI created a reproducer: git clone git@github.com:michaelKaefer/reproducer-38239.git
cd reproducer-38239
composer install No message with: $ SYMFONY_DEPRECATIONS_HELPER="disabled" ./bin/phpunit
[...]
OK (1 test, 1 assertion) With the following you get the message "THE ERROR HANDLER HAS CHANGED!", although in $ ./bin/phpunit
[...]
OK (1 test, 1 assertion)
THE ERROR HANDLER HAS CHANGED! FixI can try to fix it, this solutions come to my mind:
putenv("$envName=$envValue");
$_SERVER[$envName] = $_ENV[$envName] = $envValue;
Or is there a better solution? |
I vote for this solution. The minimalist in me says there is no need to invent tons of stuff for a simple thing such as this. |
… PHPUnit configuration file (fancyweb) This PR was merged into the 4.4 branch. Discussion ---------- [PhpUnitBridge] Fix disabling DeprecationErrorHandler from PHPUnit configuration file | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #38239 | License | MIT | Doc PR | - The linked issue description is right, the bridge's bootstrap is hit before the env variables from the phpunit.xml file are read and set. So the easiest solution is to read it ourselves in the root script (like we already do for some of them). Commits ------- 41158b8 [PhpUnitBridge] Fix disabling DeprecationErrorHandler from phpunit configuration file
… PHPUnit configuration file (fancyweb) This PR was merged into the 4.4 branch. Discussion ---------- [PhpUnitBridge] Fix disabling DeprecationErrorHandler from PHPUnit configuration file | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | symfony/symfony#38239 | License | MIT | Doc PR | - The linked issue description is right, the bridge's bootstrap is hit before the env variables from the phpunit.xml file are read and set. So the easiest solution is to read it ourselves in the root script (like we already do for some of them). Commits ------- 41158b8878 [PhpUnitBridge] Fix disabling DeprecationErrorHandler from phpunit configuration file
Symfony version(s) affected: 5.1.5
Description
This line, where
DeprecationErrorHandler
is being registered, relies on the fact that aSYMFONY_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 fromphpunit.xml
:How to reproduce
phpunit.xml
file has line:<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
THE ERROR HANDLER HAS CHANGED!
error at the end of the test, which is emitted byDeprecationErrorHandler
.SYMFONY_DEPRECATIONS_HELPER="disabled" phpunit
and no errors will be emitted.And guys... All caps?! Seriously?!
The text was updated successfully, but these errors were encountered: