diff --git a/src/Tracy/Dumper/Exposer.php b/src/Tracy/Dumper/Exposer.php index eac1892b1..18a70d6d7 100644 --- a/src/Tracy/Dumper/Exposer.php +++ b/src/Tracy/Dumper/Exposer.php @@ -113,21 +113,10 @@ public static function exposeSplObjectStorage(\SplObjectStorage $obj): array } - public static function exposePhpIncompleteClass(\__PHP_Incomplete_Class $obj): array + public static function exposePhpIncompleteClass(\__PHP_Incomplete_Class $obj, Value $value, Describer $describer): void { - $info = ['className' => null, 'private' => [], 'protected' => [], 'public' => []]; - foreach ((array) $obj as $name => $value) { - $name = (string) $name; - if ($name === '__PHP_Incomplete_Class_Name') { - $info['className'] = $value; - } elseif (preg_match('#^\x0\*\x0(.+)$#D', $name, $m)) { - $info['protected'][$m[1]] = $value; - } elseif (preg_match('#^\x0(.+)\x0(.+)$#D', $name, $m)) { - $info['private'][$m[1] . '::$' . $m[2]] = $value; - } else { - $info['public'][$name] = $value; - } - } - return $info; + self::exposeObject($obj, $value, $describer); + unset($value->items[0]); + $value->value = ((array) $obj)['__PHP_Incomplete_Class_Name'] . ' (Incomplete Class)'; } } diff --git a/tests/Tracy/Dumper.objectExporters.phpt b/tests/Tracy/Dumper.objectExporters.phpt index bbd1dff53..9cca695ae 100644 --- a/tests/Tracy/Dumper.objectExporters.phpt +++ b/tests/Tracy/Dumper.objectExporters.phpt @@ -79,18 +79,14 @@ XX $obj = unserialize('O:1:"Y":7:{s:1:"1";N;s:1:"b";i:2;s:4:"' . "\0" . '*' . "\0" . 'c";N;s:4:"' . "\0" . '*' . "\0" . 'd";s:1:"d";s:4:"' . "\0" . 'Y' . "\0" . 'e";N;s:4:"' . "\0" . 'Y' . "\0" . 'i";s:3:"bar";s:4:"' . "\0" . 'X' . "\0" . 'i";s:3:"foo";}'); Assert::match(<<<'XX' -__PHP_Incomplete_Class #%d% - className: 'Y' - private: array (3) - | 'Y::$e' => null - | 'Y::$i' => 'bar' - | 'X::$i' => 'foo' - protected: array (2) - | 'c' => null - | 'd' => 'd' - public: array (2) - | 1 => null - | 'b' => 2 +Y (Incomplete Class) #%d% + 1: null + b: 2 + c: null + d: 'd' + e: null + i: 'bar' + i: 'foo' XX , Dumper::toText($obj));