Skip to content

Commit

Permalink
Merge branch '4.3' into 4.4
Browse files Browse the repository at this point in the history
* 4.3:
  [Intl] Update the ICU data to 65.1 (4.3 branch)
  Replace deprecated calls in tests
  [Intl] Update the ICU data to 65.1
  Delete 5_Security_issue.md
  [DI] Whitelist validator.auto_mapper in UnusedTagsPass
  [HttpClient] Fixed #33832 NO_PROXY option ignored in NativeHttpClient::request() method
  [Cache] give 100ms before starting the expiration countdown
  [Cache] fix logger usage in CacheTrait::doGet()
  [VarDumper] fix dumping uninitialized SplFileInfo
  Added missing translations.
  Fixed invalid changelog 4.0.0 for VarDumper
  Fixed invalid VarDumper upgrade doc.
  [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array
  Don't let falsey usernames slip through
  • Loading branch information
nicolas-grekas committed Oct 4, 2019
2 parents dfb9df5 + bde8957 commit 0e529b0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ CHANGELOG
* support for passing `\ReflectionClass` instances to the `Caster::castObject()`
method has been dropped, pass class names as strings instead
* the `Data::getRawData()` method has been removed
* the `VarDumperTestTrait::assertDumpEquals()` method expects a 3rd `$context = null`
* the `VarDumperTestTrait::assertDumpEquals()` method expects a 3rd `$filter = 0`
argument and moves `$message = ''` argument at 4th position.
* the `VarDumperTestTrait::assertDumpMatchesFormat()` method expects a 3rd `$context = null`
* the `VarDumperTestTrait::assertDumpMatchesFormat()` method expects a 3rd `$filter = 0`
argument and moves `$message = ''` argument at 4th position.

3.4.0
Expand Down
6 changes: 6 additions & 0 deletions Caster/SplCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
19 changes: 19 additions & 0 deletions Tests/Caster/SplCasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ public function testArrayIterator()
0 => 234
]
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}

public function testBadSplFileInfo()
{
$var = new BadSplFileInfo();

$expected = <<<EOTXT
Symfony\Component\VarDumper\Tests\Caster\BadSplFileInfo {
⚠: "The parent constructor was not called: the object is in an invalid state"
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
Expand All @@ -205,3 +217,10 @@ class MyArrayIterator extends \ArrayIterator
{
private $foo = 123;
}

class BadSplFileInfo extends \SplFileInfo
{
public function __construct()
{
}
}

0 comments on commit 0e529b0

Please sign in to comment.