ID: 47671
Updated by: [email protected]
Reported By: robert at typo3 dot org
-Status: Open
+Status: Assigned
Bug Type: SPL related
Operating System: Mac OS 10.5.6
PHP Version: 5.3.0beta1
-Assigned To:
+Assigned To: colder
Previous Comments:
------------------------------------------------------------------------
[2009-03-16 11:42:11] robert at typo3 dot org
Description:
------------
After cloning an instance of SplObjectStorage the number of objects
which can be retrieved with count() is very high and foreach() causes a
segfault.
Reproduce code:
---------------
class Foo {}
$storageA = new \SplObjectStorage();
$storageA->attach(new \Foo);
$storageA->attach(new \Foo);
echo ("Count storage A: " . count($storageA));
foreach ($storageA as $object) {
echo ' x ';
}
$storageB = clone $storageA;
echo ("Count storage B: " . count($storageB));
foreach ($storageB as $object) {
echo ' x ';
}
Expected result:
----------------
Count storage A: 2 x x Count storage B: 2 x x
Actual result:
--------------
Count storage A: 2 x x Count storage B: 1953394499
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47671&edit=1