diff --git a/src/Symfony/Component/VarDumper/Caster/SplCaster.php b/src/Symfony/Component/VarDumper/Caster/SplCaster.php index a223adb7f2cae..283c5613d0c6b 100644 --- a/src/Symfony/Component/VarDumper/Caster/SplCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/SplCaster.php @@ -90,6 +90,12 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNe $prefix = Caster::PREFIX_VIRTUAL; + if (false === $c->getPathname()) { + $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state'; + + return $a; + } + foreach ($map as $key => $accessor) { try { $a[$prefix.$key] = $c->$accessor(); diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php index a146a2f6b96a8..67033df091601 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php @@ -202,6 +202,18 @@ public function testArrayIterator() 0 => 234 ] } +EOTXT; + $this->assertDumpEquals($expected, $var); + } + + public function testBadSplFileInfo() + { + $var = new BadSplFileInfo(); + + $expected = <<assertDumpEquals($expected, $var); } @@ -211,3 +223,10 @@ class MyArrayIterator extends \ArrayIterator { private $foo = 123; } + +class BadSplFileInfo extends \SplFileInfo +{ + public function __construct() + { + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy