From:             robert at typo3 dot org
Operating system: Mac OS 10.5.6
PHP version:      5.3.0beta1
PHP Bug Type:     SPL related
Bug description:  Cloning of SplObjectStorage is undefined

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 bug report at http://bugs.php.net/?id=47671&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47671&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47671&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47671&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47671&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47671&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47671&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47671&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47671&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47671&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47671&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47671&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47671&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47671&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47671&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47671&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47671&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47671&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47671&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47671&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47671&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47671&r=mysqlcfg

Reply via email to