Bug #18309: serialize of array doesn not preserve internal pointer
| From: | submiturl at vaner dot com | Date: | Fri, 12 Jul 2002 12:07:39 +0000 |
| Subject: | Bug #18309: serialize of array doesn not preserve internal pointer | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-13967@lists.php.net to get a copy of this message | ||
From: submiturl@vaner.com
Operating system: WinXP
PHP version: 4.1.2
PHP Bug Type: Arrays related
Bug description: serialize of array doesn not preserve internal pointer
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 bug report at http://bugs.php.net/?id=18309&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18309&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18309&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18309&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18309&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18309&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18309&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18309&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18309&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18309&r=globals