diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index 383abb72eb1ac..b1d0239547e34 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -6,6 +6,11 @@ DependencyInjection * Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0. +Debug +----- + + * Support for stacked errors in the `ErrorHandler` is deprecated and will be removed in Symfony 4.0. + Finder ------ diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 791fad5a0b578..8e522ca92b660 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -70,6 +70,8 @@ Debug * `FlattenException::getTrace()` now returns additional type descriptions `integer` and `float`. + * Support for stacked errors in the `ErrorHandler` has been removed + DependencyInjection ------------------- diff --git a/src/Symfony/Component/Debug/CHANGELOG.md b/src/Symfony/Component/Debug/CHANGELOG.md index a853b7a0a70a4..31c67eb60cce9 100644 --- a/src/Symfony/Component/Debug/CHANGELOG.md +++ b/src/Symfony/Component/Debug/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +3.4.0 +----- + +* deprecated `ErrorHandler::stackErrors()` and `ErrorHandler::unstackErrors()` + 3.3.0 ----- diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index 2e1d71808e132..2b13c02cf92c5 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -136,7 +136,7 @@ public static function disable() */ public function loadClass($class) { - ErrorHandler::stackErrors(); + $e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); try { if ($this->isFinder) { @@ -148,7 +148,7 @@ public function loadClass($class) $file = false; } } finally { - ErrorHandler::unstackErrors(); + error_reporting($e); } $exists = class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index e25b5a6dd8b2a..9ebe7b0d0e7bd 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -648,17 +648,25 @@ public static function handleFatalError(array $error = null) * * The most important feature of this is to prevent * autoloading until unstackErrors() is called. + * + * @deprecated since version 3.4, to be removed in 4.0. */ public static function stackErrors() { + @trigger_error('Support for stacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); } /** * Unstacks stacked errors and forwards to the logger. + * + * @deprecated since version 3.4, to be removed in 4.0. */ public static function unstackErrors() { + @trigger_error('Support for unstacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + $level = array_pop(self::$stackedErrorLevels); if (null !== $level) { diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index a14accf3df9a0..41d1bea77e123 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -342,6 +342,9 @@ public function testHandleException() } } + /** + * @group legacy + */ public function testErrorStacking() { try { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy