bug #28524 [PhpUnitBridge] fix disabling DeprecationErrorHandler using phpunit.xml file (soerenbernstein)

This PR was submitted for the master branch but it was squashed and merged into the 3.4 branch instead (closes #28524).

Discussion
----------

[PhpUnitBridge] fix disabling DeprecationErrorHandler using phpunit.xml file

Fixing #28519

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | don't know
| Fixed tickets | #28519
| License       | MIT

Commits
-------

3cd929bee0 [PhpUnitBridge] fix disabling DeprecationErrorHandler using phpunit.xml file
This commit is contained in:
Nicolas Grekas 2018-09-20 09:47:32 +02:00
commit da1999856f

View File

@ -54,7 +54,11 @@ class DeprecationErrorHandler
if (false === $mode) {
$mode = getenv('SYMFONY_DEPRECATIONS_HELPER');
}
if (DeprecationErrorHandler::MODE_WEAK !== $mode && DeprecationErrorHandler::MODE_WEAK_VENDORS !== $mode && (!isset($mode[0]) || '/' !== $mode[0])) {
if (DeprecationErrorHandler::MODE_DISABLED !== $mode
&& DeprecationErrorHandler::MODE_WEAK !== $mode
&& DeprecationErrorHandler::MODE_WEAK_VENDORS !== $mode
&& (!isset($mode[0]) || '/' !== $mode[0])
) {
$mode = preg_match('/^[1-9][0-9]*$/', $mode) ? (int) $mode : 0;
}