Skip to content

Commit bde8957

Browse files
Merge branch '3.4' into 4.3
* 3.4: [Intl] Update the ICU data to 65.1 [VarDumper] fix dumping uninitialized SplFileInfo Added missing translations. Fixed invalid VarDumper upgrade doc. [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array Don't let falsey usernames slip through
2 parents 3495735 + bd54d0c commit bde8957

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Caster/SplCaster.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNe
9090

9191
$prefix = Caster::PREFIX_VIRTUAL;
9292

93+
if (false === $c->getPathname()) {
94+
$a[$prefix.''] = 'The parent constructor was not called: the object is in an invalid state';
95+
96+
return $a;
97+
}
98+
9399
foreach ($map as $key => $accessor) {
94100
try {
95101
$a[$prefix.$key] = $c->$accessor();

Tests/Caster/SplCasterTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,18 @@ public function testArrayIterator()
196196
0 => 234
197197
]
198198
}
199+
EOTXT;
200+
$this->assertDumpEquals($expected, $var);
201+
}
202+
203+
public function testBadSplFileInfo()
204+
{
205+
$var = new BadSplFileInfo();
206+
207+
$expected = <<<EOTXT
208+
Symfony\Component\VarDumper\Tests\Caster\BadSplFileInfo {
209+
⚠: "The parent constructor was not called: the object is in an invalid state"
210+
}
199211
EOTXT;
200212
$this->assertDumpEquals($expected, $var);
201213
}
@@ -205,3 +217,10 @@ class MyArrayIterator extends \ArrayIterator
205217
{
206218
private $foo = 123;
207219
}
220+
221+
class BadSplFileInfo extends \SplFileInfo
222+
{
223+
public function __construct()
224+
{
225+
}
226+
}

0 commit comments

Comments
 (0)