#30315 [Opn]: big integers don't overflow

2004-10-05 Thread jorton
 ID:   30315
 Updated by:   [EMAIL PROTECTED]
 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:

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.


Previous Comments:


[2004-10-04 10:03:43] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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=30315edit=1


#30315 [Opn]: big integers don't overflow

2004-10-05 Thread derick
 ID:   30315
 Updated by:   [EMAIL PROTECTED]
 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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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=30315edit=1


#30315 [Opn]: big integers don't overflow

2004-10-05 Thread jorton
 ID:   30315
 Updated by:   [EMAIL PROTECTED]
 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:

I would argue that backwards compatibility is about making guarantees
and not breaking them.  It's not about simply ensuring that all
behaviour remains exactly the same forever, otherwise you can't change
anything at all.  

But no guarantee was broken in this change.


Previous Comments:


[2004-10-05 14:48:28] [EMAIL PROTECTED]

But it's still breaking backward compatibility, and that is also
important. IMO this should just work like it did before.



[2004-10-05 14:43:30] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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.

.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30315

-- 
Edit this bug report at http://bugs.php.net/?id=30315edit=1