Skip to content

Commit

Permalink
bug #36993 [ErrorHandler] fix setting $trace to null in FatalError (n…
Browse files Browse the repository at this point in the history
…icolas-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
  • Loading branch information
nicolas-grekas committed May 28, 2020
2 parents 5fe0f94 + aa50c92 commit 0d2bc7b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Symfony/Component/ErrorHandler/Error/FatalError.php
Expand Up @@ -72,9 +72,11 @@ public function __construct(string $message, int $code, array $error, int $trace
'line' => $error['line'],
'trace' => $trace,
] as $property => $value) {
$refl = new \ReflectionProperty(\Error::class, $property);
$refl->setAccessible(true);
$refl->setValue($this, $value);
if (null !== $value) {
$refl = new \ReflectionProperty(\Error::class, $property);
$refl->setAccessible(true);
$refl->setValue($this, $value);
}
}
}

Expand Down

0 comments on commit 0d2bc7b

Please sign in to comment.