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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wsl at fruit dot warande dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 16:01:36 2025 UTC