Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #30264 [Debug][ErrorHandler] Preserve next error handler (fancyweb)
This PR was merged into the 3.4 branch. Discussion ---------- [Debug][ErrorHandler] Preserve next error handler | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30140 | License | MIT | Doc PR | - Thank you @cuchac Getting the current error handler in the error handler itself actually works. If you try to see the content of the `$currentErrorHandler` var however, you will always see `null`. That's why I thought it was impossible. Because I did not test from end to end until today. Commits ------- a8b3434 [Debug][ErrorHandler] Preserve next error handler
- Loading branch information
Showing
4 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/Symfony/Component/Debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Debug\Tests\Fixtures; | ||
|
||
class ErrorHandlerThatUsesThePreviousOne | ||
{ | ||
private static $previous; | ||
|
||
public static function register() | ||
{ | ||
$handler = new static(); | ||
|
||
self::$previous = set_error_handler([$handler, 'handleError']); | ||
|
||
return $handler; | ||
} | ||
|
||
public function handleError($type, $message, $file, $line, $context) | ||
{ | ||
return \call_user_func(self::$previous, $type, $message, $file, $line, $context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters