php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2261 Binary operators fail on args > 2G
Submitted: 1999-09-08 06:34 UTC Modified: 1999-09-09 09:05 UTC
From: wsl at fruit dot warande dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 2 OS: Debian GNU/Linux i386 Potato
Private report: No CVE-ID: None
 [1999-09-08 06:34 UTC] wsl at fruit dot warande dot net
<?
        $n = 2211674498;
        $a = $n >> 24;
        $b = ($n >> 16) & 255;
        $c = ($n >> 8) & 255;
        $d = $n & 255;
        echo "<p>$a.$b.$c.$d</p>\n";
?>

It should output 131.211.121.130 (my IP-number) but outputs -128.0.0.0 instead. If I set $n to 211674498, it works fine.

Config options and compiler (options) used:

# ./configure  --with-apxs=/usr/bin/apxs --with-mysql --with-zlib --disable-static --disable-debug --prefix=/usr --sysconfdir=/etc
# gcc -O6 -mpentium -fomit-frame-pointer -pipe -w -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.1/specs
gcc version 2.95.1 19990816 (release)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-09-09 09:04 UTC] andi at cvs dot php dot net
You have reached the limit of the long type on your architecture. If you want arbitrary math precision use the BC module which gives you access to such functions.

 [1999-09-09 09:05 UTC] andi at cvs dot php dot net
You have reached the limit of the long type on your architecture. If you want arbitrary math precision use the BC module which gives you access to such functions.
You will need to download http://www.php.net/version4/downloads/number.tar.gz and put those files in ext/bcmath in your PHP 4.0 tree.

 [1999-09-09 09:05 UTC] andi at cvs dot php dot net
You have reached the limit of the long type on your architecture. If you want arbitrary math precision use the BC module which gives you access to such functions.
You will need to download http://www.php.net/version4/downloads/number/

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Feb 24 12:01:25 2020 UTC