#32213 [NEW]: Array key serialize problem 64 bit php

From: Date: Mon, 07 Mar 2005 02:45:53 +0000
Subject: #32213 [NEW]: Array key serialize problem 64 bit php
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74998@lists.php.net to get a copy of this message
From: csmith at cbbc dot murdoch dot edu dot au Operating system: Linux PHP version: 5.0.3 PHP Bug Type: Session related Bug description: Array key serialize problem 64 bit php Description: ------------ Having this bug in 64 bit versions of php only. 32 bit versions work as expected. If you create an array with large integers as the keys, serialize the array, and unserialize the array, (so you can pass it through a session) the array key value is not being type promoted to a data type that can store the large integer. Instead you get a different value back as the key after unserializing the array. This is happening with the 64 bit versions of 5.0.3 and 4.3.2. Reproduce code: --------------- $array["1234567891011"] = 'test'; print "The array:<br/>"; var_dump( $array); $array_serialized = serialize($array); $array_unserialized = unserialize($array_serialized); print "<br/>The unserialized array:<br/>"; var_dump($array_unserialized); Expected result: ---------------- The array: array(1) { [1234567891011]=> string(4) "test" } The unserialized array: array(1) { [1234567891011]=> string(4) "test" } *Note: this is what you get back in the 32 bit version of php. Actual result: -------------- The array: array(1) { [1234567891011]=> string(4) "test" } The unserialized array: array(1) { [1912277059]=> string(4) "test" } *Note: this is what you get back in the 64 bit version of php. -- Edit bug report at http://bugs.php.net/?id=32213&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32213&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32213&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32213&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32213&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32213&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32213&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32213&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32213&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32213&r=support Expected behavior: http://bugs.php.net/fix.php?id=32213&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32213&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32213&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32213&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32213&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32213&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32213&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32213&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32213&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32213&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32213&r=mysqlcfg

« previous php.bugs (#74998) next »