Skip to content

Commit

Permalink
Fix trying to read uninitialized properties when fetching call stack …
Browse files Browse the repository at this point in the history
…during exception handling

"Typed property ... must not be accessed before initialization" error was displayed instead of CakePHP error page with call stack
  • Loading branch information
daris authored and kamilwylegala committed Nov 2, 2023
1 parent 1cd99ff commit 1a06136
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Cake/Utility/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ protected static function _object($var, $depth, $indent) {
$reflectionProperties = $ref->getProperties($filter);
foreach ($reflectionProperties as $reflectionProperty) {
$reflectionProperty->setAccessible(true);

if (!$reflectionProperty->isInitialized($var)) {
continue;
}

$property = $reflectionProperty->getValue($var);

$value = static::_export($property, $depth - 1, $indent);
Expand Down

0 comments on commit 1a06136

Please sign in to comment.