minor #10988 [Debug] preserve modified error level (nicolas-grekas)

This PR was merged into the 2.5 branch.

Discussion
----------

[Debug] preserve modified error level

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

Minor edge case, but still a bug fix.
Replaces https://github.com/symfony/symfony/pull/10978

Commits
-------

e40b717 [Debug] preserve modified error level
This commit is contained in:
Fabien Potencier 2014-05-25 16:44:21 +02:00
commit 0572674ac0

View File

@ -226,7 +226,11 @@ class ErrorHandler
$level = array_pop(self::$stackedErrorLevels);
if (null !== $level) {
error_reporting($level);
$e = error_reporting($level);
if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
// If the user changed the error level, do not overwrite it
error_reporting($e);
}
}
if (empty(self::$stackedErrorLevels)) {