Deprecate support for stacked errors
This commit is contained in:
parent
a1c77e7c55
commit
04b8b8027c
|
@ -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
|
||||
------
|
||||
|
||||
|
|
|
@ -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
|
||||
-------------------
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
||||
* deprecated `ErrorHandler::stackErrors()` and `ErrorHandler::unstackErrors()`
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ class DebugClassLoader
|
|||
*/
|
||||
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 @@ class DebugClassLoader
|
|||
$file = false;
|
||||
}
|
||||
} finally {
|
||||
ErrorHandler::unstackErrors();
|
||||
error_reporting($e);
|
||||
}
|
||||
|
||||
$exists = class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
|
||||
|
|
|
@ -648,17 +648,25 @@ class ErrorHandler
|
|||
*
|
||||
* 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) {
|
||||
|
|
|
@ -342,6 +342,9 @@ class ErrorHandlerTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testErrorStacking()
|
||||
{
|
||||
try {
|
||||
|
|
Reference in New Issue