#47671 [Asn->Csd]: Cloning of SplObjectStorage is undefined
ID: 47671
Updated by: colder@php.net
Reported By: robert at typo3 dot org
-Status: Assigned
+Status: Closed
Bug Type: SPL related
Operating System: Mac OS 10.5.6
PHP Version: 5.3.0beta1
Assigned To: colder
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
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
Thread (3 messages)