bug #17766 Fixed (string) catchable fatal error for PHP Incomplete Class instances (yceruto)
This PR was merged into the 2.3 branch.
Discussion
----------
Fixed (string) catchable fatal error for PHP Incomplete Class instances
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #17586
| License | MIT
| Doc PR | -
Fixing for 2.3 branch.
Commits
-------
bb29979
avoid (string) catchable fatal error for __PHP_Incomplete_Class instances
This commit is contained in:
commit
81d654fb5c
@ -45,6 +45,10 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
|
||||
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)) {
|
||||
$a = array();
|
||||
foreach ($var as $k => $v) {
|
||||
@ -72,4 +76,11 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
|
||||
|
||||
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