ID:               39836
 Updated by:       [EMAIL PROTECTED]
 Reported By:      doublecompile at gmail dot com
 Status:           Open
 Bug Type:         SPL related
 Operating System: *
 PHP Version:      5.2.0
 Assigned To:      helly
 New Comment:

Actually this is a feature request. Overloaded objects are typically
not serializable even though PHP in theory has everything to allow
that.


Previous Comments:
------------------------------------------------------------------------

[2006-12-14 22:12:46] doublecompile at gmail dot com

Description:
------------
I serialized a SplObjectStorage instance containing several objects. 
After unserialization, the SplObjectStorage object contained nothing.

It doesn't say in the SPL documentation that SplObjectStorage cannot be
serialized.

Reproduce code:
---------------
<?php

class test { }

$storage = new SplObjectStorage();

for( $i=0; $i<5; $i++ ) {
     $test = new test();
     $test->example = 'testing'.$i;
     $storage->attach( $test );
}

echo "Before: ".count($storage)."<br>";

$str = serialize($storage);

$storage2 = unserialize( $str );

echo "After: ".count($storage2)."<br>";

?>

Expected result:
----------------
Before: 5
After: 5

Actual result:
--------------
Before: 5
After: 0


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39836&edit=1

Reply via email to