Edit report at http://bugs.php.net/bug.php?id=54547&edit=1
ID: 54547
Updated by: cataphract@php.net
Reported by: peter dot ritt at gmx dot net
Summary: wrong equality of string numbers
Status: Verified
Type: Bug
Package: Unknown/Other Function
Operating System: linux
PHP Version: 5.3.6
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
Maybe this should be Won't Fix to keep it consistent with
9223372036854775807 == 9223372036854775808 (with number literals).
Previous Comments:
------------------------------------------------------------------------
[2011-04-17 05:44:03] cataphract@php.net
The following patch has been added/updated:
Patch Name: bug54547-2.diff
Revision: 1303011843
URL:
http://bugs.php.net/patch-display.php?bug=54547&patch=bug54547-2.diff&revision=1303011843
------------------------------------------------------------------------
[2011-04-17 01:59:59] cataphract@php.net
The following patch has been added/updated:
Patch Name: bug54547.diff
Revision: 1302998399
URL:
http://bugs.php.net/patch-display.php?bug=54547&patch=bug54547.diff&revision=1302998399
------------------------------------------------------------------------
[2011-04-16 20:07:43] peter dot ritt at gmx dot net
Description:
------------
comparison of strings using == shows wrong results when both strings are
numbers (digits) around PHP_MAX_INT;
the same comparison using === works correctly;
tested on 64 bit systems only, affects also PHP 5.3.5
Test script:
---------------
$a = '9223372036854775807';
$b = '9223372036854775808';
if ($a == $b) {
echo "$a == $b\n";
}
else {
echo "$a != $b\n";
}
// displays 9223372036854775807 == 9223372036854775808
Expected result:
----------------
should display
9223372036854775807 != 9223372036854775808
Actual result:
--------------
displays
9223372036854775807 == 9223372036854775808
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54547&edit=1