8000 minor #54258 [ErrorHandler] Fix tests (nicolas-grekas) · symfony/symfony@8832a0a · GitHub
[go: up one dir, main page]

Skip to content

Commit 8832a0a

Browse files
minor #54258 [ErrorHandler] Fix tests (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [ErrorHandler] Fix tests | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Fixing #54189 Commits ------- 59d7c72 [ErrorHandler] Fix tests
2 parents 866be24 + 59d7c72 commit 8832a0a

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