8000 [ErrorHandler] Fix tests · symfony/symfony@59d7c72 · GitHub
[go: up one dir, main page]

Skip to content

Commit 59d7c72

Browse files
[ErrorHandler] Fix tests
1 parent 9d362b1 commit 59d7c72

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Symfony/Component/ErrorHandler/ErrorHandler.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,12 @@ public function handleError(int $type, string $message, string $file, int $line)
517517
}
518518

519519
// Display the original error message instead of the default one.
520-
$this->handleException($errorAsException);
520+
$exitCode = self::$exitCode;
521+
try {
522+
$this->handleException($errorAsException);
523+
} finally {
524+
self::$exitCode = $exitCode;
525+
}
521526

522527
// Stop the process by giving back the error to the native handler.
523528
return false;

src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
*/
3232
class ErrorHandlerTest extends TestCase
3333
{
34+
public function tearDown(): void
35+
{
36+
$r = new \ReflectionProperty(ErrorHandler::class, 'exitCode');
37+
$r->setAccessible(true);
38+
$r->setValue(null, 0);
39+
}
40+
3441
public function testRegister()
3542
{
3643
$handler = ErrorHandler::register();

0 commit comments

Comments
 (0)
0