#30315 [Opn]: big integers don't overflow
| From: | derick@php.net | Date: | Tue, 05 Oct 2004 12:48:29 +0000 |
| Subject: | #30315 [Opn]: big integers don't overflow | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67136@lists.php.net to get a copy of this message | ||
ID: 30315
Updated by: derick@php.net
Reported By: tokul at users dot sourceforge dot net
Status: Open
Bug Type: Variables related
Operating System: Linux
PHP Version: 5.0.2
New Comment:
But it's still breaking backward compatibility, and that is also
important. IMO this should just work like it did before.
Previous Comments:
------------------------------------------------------------------------
[2004-10-05 14:43:30] jorton@php.net
PHP never guaranteed that integers larger than 2^31 wrap negative. It
has never been true on a 64-bit platform, for example; there, your
code will have always printed "3725722773".
I don't think this is a PHP bug.
------------------------------------------------------------------------
[2004-10-04 10:03:43] derick@php.net
You didn't mention that before ;-) So no, then this is ofcourse a bug.
------------------------------------------------------------------------
[2004-10-04 08:58:11] tokul at users dot sourceforge dot net
Have you checked php behaviour in other php versions?
I have also tested 4.1.2, 4.3.9 and 5.0.1. This happens only on 5.0.2.
I just need to know, if this is a bug or default behaviour in future
php versions.
------------------------------------------------------------------------
[2004-10-04 08:39:49] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
.
------------------------------------------------------------------------
[2004-10-03 21:35:01] tokul at users dot sourceforge dot net
Description:
------------
If big number (2500072158) is converted to integer, php 5.0.2 does not
overflow and uses max integer value (2147483647).
OS details: Linux Debian Sarge
PHP compilation details (vanilla php-5.0.2.tar.bz2):
./configure --disable-debug --with-apxs=/somepath/apache/bin/apxs
--prefix=/somepath/php
--with-config-file-path=/somepath/
--with-pcre-regex --enable-mbstring --enable-session --disable-all
--with-gettext=shared,/usr
php.ini details:
error_reporting=E_ALL
display_errors=on
register_globals=off
asp_tags=on
short_tags=off
Is this standard future php behaviour or just some error in my config?
Reproduce code:
---------------
echo (int)0xde120495;
Expected result:
----------------
-569244523
Actual result:
--------------
2147483647
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30315&edit=1