Try this code:

<pre>
<?php

$Arr = array();
$Arr['self'] = &$Arr;
var_dump ( $Arr );

$serdata = serialize ($Arr);
$Arr2 = unserialize ( $serdata );
echo "\n\n";
var_dump ( $Arr2 );

?>
</pre>

The second array is expected to be exactly as $Arr, but it doesn't. This is the output for that code:

array(1) {
 ["self"]=>
 array(1) {
   ["self"]=>
   *RECURSION*
 }
}

array(1) {
 ["self"]=>
 array(1) {
   ["self"]=>
   NULL
 }
}

As you can see the second array has a NULL value where the first one had a recursive reference.

Can this be considered as a bug of PHP serialization system?

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to