php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39641 Expression evaluation violates intuition
Submitted: 2006-11-27 05:10 UTC Modified: 2007-03-28 10:30 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: netex at 163 dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.2.0 OS: FreeBSD 6.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: netex at 163 dot com
New email:
PHP Version: OS:

 

 [2006-11-27 05:10 UTC] netex at 163 dot com
Description:
------------
Expression evaluation violates intuition, see the code:

Reproduce code:
---------------
<?
$a = -1109046485 & 0xffffffff;
$b = -1129749216 & 0xffffffff;
printf("%x + %x = %x\n",$a,$b,$a+$b);
printf("%x\n", 0xbde54b2b + 0xbca96520);
?>


Expected result:
----------------
X-Powered-By: PHP/5.2.0
Content-type: text/html

bde54b2b + bca96520 = 7a8eb04b
7a8eb04b


Actual result:
--------------
X-Powered-By: PHP/5.2.0
Content-type: text/html

bde54b2b + bca96520 = 80000000
7a8eb04b


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-27 09:54 UTC] tony2001@php.net
That's exactly what I get on Linux and FreeBSD 5.5-RELEASE.
 [2006-12-05 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-02-08 16:39 UTC] netex at 163 dot com
Still happens in 5.2.1
 [2007-03-28 10:30 UTC] tony2001@php.net
Compare these values:
var_dump($a+$b);
var_dump(0xbde54b2b + 0xbca96520);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC