Bug #72390 [Opn->Nab]: Error in Serialize function

From: Date: Mon, 13 Jun 2016 11:06:05 +0000
Subject: Bug #72390 [Opn->Nab]: Error in Serialize function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201563@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72390&edit=1 ID: 72390 Updated by: cmb@php.net Reported by: kanduganesh at gmail dot com Summary: Error in Serialize function -Status: Open +Status: Not a bug Type: Bug Package: *General Issues -Operating System: Windows +Operating System: Windows 32-bit PHP Version: 5.6.22 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: That's obviously an integer overflow on a 32-bit system (no issue on 64-bit systems, see <https://3v4l.org/4SLi0>), and as such is expected behavior, so this is not a bug. Note that on 32-bit systems var_dump(2206427175) prints double(2206427175), and the documentation states[1] that "Floats are also cast to integers, […]", so in your case the array has already the negative key, so serialize() behaves correctly; to verify do print_r(array(2206427175 => 'user')) [1] <http://php.net/manual/en/language.types.array.php#example-99> Previous Comments: ------------------------------------------------------------------------ [2016-06-12 14:37:02] kanduganesh at gmail dot com Description: ------------ getting error or corrupt output of serialized string when i am serializing array Test script: --------------- <?php echo "<pre>"; $ser = array( 2206427175 => 'user' ); $ser = serialize($ser); print_r(unserialize($ser)); Expected result: ---------------- Array ( [2206427175] => user ) Actual result: -------------- Array ( [-2088540121] => user ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72390&edit=1

« previous php.bugs (#201563) next »