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.
|
* 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
|
Finder
|
||||||
------
|
------
|
||||||
|
|
||||||
|
@ -70,6 +70,8 @@ Debug
|
|||||||
* `FlattenException::getTrace()` now returns additional type descriptions
|
* `FlattenException::getTrace()` now returns additional type descriptions
|
||||||
`integer` and `float`.
|
`integer` and `float`.
|
||||||
|
|
||||||
|
* Support for stacked errors in the `ErrorHandler` has been removed
|
||||||
|
|
||||||
DependencyInjection
|
DependencyInjection
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
3.4.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
* deprecated `ErrorHandler::stackErrors()` and `ErrorHandler::unstackErrors()`
|
||||||
|
|
||||||
3.3.0
|
3.3.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class DebugClassLoader
|
|||||||
*/
|
*/
|
||||||
public function loadClass($class)
|
public function loadClass($class)
|
||||||
{
|
{
|
||||||
ErrorHandler::stackErrors();
|
$e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($this->isFinder) {
|
if ($this->isFinder) {
|
||||||
@ -148,7 +148,7 @@ class DebugClassLoader
|
|||||||
$file = false;
|
$file = false;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
ErrorHandler::unstackErrors();
|
error_reporting($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$exists = class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
|
$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
|
* The most important feature of this is to prevent
|
||||||
* autoloading until unstackErrors() is called.
|
* autoloading until unstackErrors() is called.
|
||||||
|
*
|
||||||
|
* @deprecated since version 3.4, to be removed in 4.0.
|
||||||
*/
|
*/
|
||||||
public static function stackErrors()
|
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);
|
self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unstacks stacked errors and forwards to the logger.
|
* Unstacks stacked errors and forwards to the logger.
|
||||||
|
*
|
||||||
|
* @deprecated since version 3.4, to be removed in 4.0.
|
||||||
*/
|
*/
|
||||||
public static function unstackErrors()
|
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);
|
$level = array_pop(self::$stackedErrorLevels);
|
||||||
|
|
||||||
if (null !== $level) {
|
if (null !== $level) {
|
||||||
|
@ -342,6 +342,9 @@ class ErrorHandlerTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
public function testErrorStacking()
|
public function testErrorStacking()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user