Skip to content

Commit 0d2bc7b

Browse files
bug #36993 [ErrorHandler] fix setting $trace to null in FatalError (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [ErrorHandler] fix setting $trace to null in FatalError | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Spotted by @nikic in php/php-src#5620 (comment) Commits ------- aa50c92 [ErrorHandler] fix setting $trace to null in FatalError
2 parents 5fe0f94 + aa50c92 commit 0d2bc7b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Component/ErrorHandler/Error/FatalError.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ public function __construct(string $message, int $code, array $error, int $trace
7272
'line' => $error['line'],
7373
'trace' => $trace,
7474
] as $property => $value) {
75-
$refl = new \ReflectionProperty(\Error::class, $property);
76-
$refl->setAccessible(true);
77-
$refl->setValue($this, $value);
75+
if (null !== $value) {
76+
$refl = new \ReflectionProperty(\Error::class, $property);
77+
$refl->setAccessible(true);
78+
$refl->setValue($this, $value);
79+
}
7880
}
7981
}
8082

0 commit comments

Comments
 (0)