Skip to content

Commit bb29979

Browse files
committed
avoid (string) catchable fatal error for __PHP_Incomplete_Class instances
1 parent 2573a38 commit bb29979

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php

+11
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ protected function varToString($var)
4545
return sprintf('Object(%s)', get_class($var));
4646
}
4747

48+
if ($var instanceof \__PHP_Incomplete_Class) {
49+
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($var));
50+
}
51+
4852
if (is_array($var)) {
4953
$a = array();
5054
foreach ($var as $k => $v) {
@@ -72,4 +76,11 @@ protected function varToString($var)
7276

7377
return (string) $var;
7478
}
79+
80+
private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $var)
81+
{
82+
$array = new \ArrayObject($var);
83+
84+
return $array['__PHP_Incomplete_Class_Name'];
85+
}
7586
}

0 commit comments

Comments
 (0)