Skip to content

[Debug] Deprecate support for stacked errors #22832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADE-3.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------

Expand Down
2 changes: 2 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------

Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Debug/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

3.4.0
-----

* deprecated `ErrorHandler::stackErrors()` and `ErrorHandler::unstackErrors()`

3.3.0
-----

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Debug/DebugClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions src/Symfony/Component/Debug/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ public function testHandleException()
}
}

/**
* @group legacy
*/
public function testErrorStacking()
{
try {
Expand Down
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