serialize bug with array that references to itself?

From: Date: Wed, 03 Nov 2004 13:36:08 +0000
Subject: serialize bug with array that references to itself?
Groups: php.internals 
Request: Send a blank email to internals+get-13705@lists.php.net to get a copy of this message
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?

« previous php.internals (#13705) next »