[VarDumper] Fix dumping of SplObjectStorage
This commit is contained in:
parent
b97a4ae031
commit
b2ac6b6fbf
@ -86,10 +86,11 @@ class SplCaster
|
|||||||
$storage = array();
|
$storage = array();
|
||||||
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
|
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
|
||||||
|
|
||||||
foreach (clone $c as $obj) {
|
$clone = clone $c;
|
||||||
|
foreach ($clone as $obj) {
|
||||||
$storage[spl_object_hash($obj)] = array(
|
$storage[spl_object_hash($obj)] = array(
|
||||||
'object' => $obj,
|
'object' => $obj,
|
||||||
'info' => $c->getInfo(),
|
'info' => $clone->getInfo(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,4 +40,23 @@ EOTXT;
|
|||||||
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
|
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCastObjectStorageIsntModified()
|
||||||
|
{
|
||||||
|
$var = new \SplObjectStorage();
|
||||||
|
$var->attach(new \stdClass());
|
||||||
|
$var->rewind();
|
||||||
|
$current = $var->current();
|
||||||
|
|
||||||
|
$this->assertDumpMatchesFormat('%A', $var);
|
||||||
|
$this->assertSame($current, $var->current());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCastObjectStorageDumpsInfo()
|
||||||
|
{
|
||||||
|
$var = new \SplObjectStorage();
|
||||||
|
$var->attach(new \stdClass(), new \DateTime());
|
||||||
|
|
||||||
|
$this->assertDumpMatchesFormat('%ADateTime%A', $var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user