avoid (string) catchable fatal error for __PHP_Incomplete_Class instances
This commit is contained in:
parent
2573a380f8
commit
bb29979218
@ -45,6 +45,10 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
|
|||||||
return sprintf('Object(%s)', get_class($var));
|
return sprintf('Object(%s)', get_class($var));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($var instanceof \__PHP_Incomplete_Class) {
|
||||||
|
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($var));
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($var)) {
|
if (is_array($var)) {
|
||||||
$a = array();
|
$a = array();
|
||||||
foreach ($var as $k => $v) {
|
foreach ($var as $k => $v) {
|
||||||
@ -72,4 +76,11 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
|
|||||||
|
|
||||||
return (string) $var;
|
return (string) $var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $var)
|
||||||
|
{
|
||||||
|
$array = new \ArrayObject($var);
|
||||||
|
|
||||||
|
return $array['__PHP_Incomplete_Class_Name'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user