8000 bug #17766 Fixed (string) catchable fatal error for PHP Incomplete Cl… · symfony/symfony@81d654f · GitHub
[go: up one dir, main page]

Skip to content

Commit 81d654f

Browse files
committed
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
2 parents d0324e4 + bb29979 commit 81d654f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
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)
0