bug #23176 [VarDumper] fixes (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] fixes

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23115 and #23151 (hopefully)
| License       | MIT
| Doc PR        | -

it looks like stream_context_get_params can return false (looking at php-src and #23151)
and doing a foreach on SplObjectStorage changes its internal iterator state.

Commits
-------

d7238c9d96 [VarDumper] fixes
This commit is contained in:
Fabien Potencier 2017-06-14 12:17:45 -07:00
commit d1104da966
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ class ResourceCaster
public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
{
return stream_context_get_params($stream);
return @stream_context_get_params($stream) ?: $a;
}
public static function castGd($gd, array $a, Stub $stub, $isNested)

View File

@ -86,7 +86,7 @@ class SplCaster
$storage = array();
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
foreach ($c as $obj) {
foreach (clone $c as $obj) {
$storage[spl_object_hash($obj)] = array(
'object' => $obj,
'info' => $c->getInfo(),