|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42989 Diffrent results on windows and linux with same script
Submitted: 2007-10-16 12:59 UTC Modified: 2007-10-25 13:52 UTC
Avg. Score:4.0 ± 1.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: naox at o2 dot pl Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.2.4 OS: linux and windows
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: naox at o2 dot pl
New email:
PHP Version: OS:


 [2007-10-16 12:59 UTC] naox at o2 dot pl
Following script will output DIFFRENT result on windows and linux. Tested with php-5.2.4, php-5.2.0, php-4.4.7

PHP compiled on linux centos 4.5
root@sv2 [/usr] uname -a
Linux #7 SMP Thu Sep 13 10:22:01 CEST 2007 i686 i686 i386 GNU/Linux

'./configure' '--prefix' '/usr/php-5.2.4.cgi' '--enable-force-cgi-redirect' '--with-xml' '--with-curl=/usr/curl' '--enable-exif' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-iconv' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-pear' '--with-pgsql=/var/pgsql/bin/pg_config' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-zlib' '--with-gettext' '--enable-bcmath' '--with-bz2' '--with-mysqli=/var/mysql5/bin/mysql_config' '--with-mysql=/var/mysql5' '--with-pdo' '--with-pdo-mysql' '--without-sqlite' '--with-xsl' '--enable-mbstring' '--with-pdo-pgsql' '--enable-soap'

Reproduce code:

$a = (float) -4738698913;
$g = (int) 43814;

$a ^= $g;

echo $a;


Expected result:
On windows:

On linux:

Windows output is correct result!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-16 17:10 UTC] naox at o2 dot pl
This actualy comes downs to this:

$a = -4738698913;
echo sprintf('%b', $a);

On windows it produces proper
However on linux its
 [2007-10-25 13:52 UTC]
And on a 64bit machine I get: -4738672007 which is the only correct answer. You're trying to deal with bigger numbers than your OS/CPU allows. Not a PHP bug.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Dec 05 18:01:29 2023 UTC