Bug #18309 Updated: serialize of array doesn not preserve internal pointer

From: Date: Fri, 12 Jul 2002 12:11:56 +0000
Subject: Bug #18309 Updated: serialize of array doesn not preserve internal pointer
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13972@lists.php.net to get a copy of this message
ID: 18309 Updated by: derick@php.net Reported By: submiturl@vaner.com -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: WinXP PHP Version: 4.1.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2002-07-12 08:07:38] submiturl@vaner.com When array is serialized and unserialized the internal pointer is not preserved. that means not the exact copy of the array is created. -------------code----------- <? $array = Array(); $array []=count($array); $array []=count($array); $array []=count($array); $array []=count($array); $array []=count($array); $array []=count($array); $array []=count($array); $array []=count($array); $array []=count($array); $array []=count($array); print_r($array); echo "<hr>"; next($array); next($array); next($array); echo "before: ".current($array); $array_serialized = serialize ($array); unset($array); echo "<hr>"; $new_array = unserialize ($array_serialized); echo "after".current($new_array); ?> --------------------------- output : Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8] => 8 [9] => 9 ) -------------------------------------------------------------------------------- before: 3 -------------------------------------------------------------------------------- after0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18309&edit=1

« previous php.bugs (#13972) next »