My understanding is 64bit machines use 64bit integers, so 1 <<31 doesn't
overflow on 64bit.  However on 32bit is does overflow.  Even though an
unsigned integer is being printed, a signed integer is being calculated
as shown below;

printf("%s\n", (1 << 31)); returns -2147483648

This suggests it's wrapped back to the other end of the signed loop.

I believe the issue is that you wrap a signed integer on 32bit, and then
php doesn't get you back from the edge to give meaningful values.  I
don't have the php debugging skills to nail down the specific issue with
integer wraparound.  But that is certainly what's being experienced.


PHP Version
--
PHP 5.2.4-2ubuntu5 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 27 2008 
20:43:54) 
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

-- 
number handling in php broken on 32bit system
https://bugs.launchpad.net/bugs/184747
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in ubuntu.

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to