Edit report at https://bugs.php.net/bug.php?id=62097&edit=1

 ID:                 62097
 User updated by:    kazuo at o-ishi dot jp
 Reported by:        kazuo at o-ishi dot jp
 Summary:            New behavior of string == has a compatibility
                     problem
-Status:             Closed
+Status:             Assigned
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Gentoo Linux
 PHP Version:        5.4.4RC1
 Assigned To:        stas
 Block user comment: N
 Private report:     N

 New Comment:

Hi,

This is one more case in 32-bit build:

  "1234567890123456789" == "12345678901.23456789E8"
     => TRUE in 5.4.3
        FALSE in latest


In addition, as I had already reported,

(64-bit environment)

   "9223372036854775808" == "09223372036854775808"
     => TRUE in 5.4.3
        FALSE in latest

   "9223372036854775808" == " 9223372036854775808"
     => TRUE in 5.4.3
        FALSE in latest

(32-bit environment)
  
   "9007199254740992" == "9007199254740992."
     => TRUE in 5.4.3
        FALSE in latest

   "9007199254740992" == " 9007199254740992"
     => TRUE in 5.4.3
        FALSE in latest

   "9007199254740992" == "09007199254740992"
     => TRUE in 5.4.3
        FALSE in latest

----------------------
I think that NEW RULE of == comparing is difficult
to understand and there are some incompatibility from OLD RULE.
At least, it is needed to be described explicitly.
(Of course, OLD RULE is already complex enough...)

OLD RULE:

 When both strings look like numbers, they are converted to numbers
 before == comparing.

 Conversion rule from string to number is described in
 
http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion
 
    If the string does not contain any of the characters '.', 'e', or
    'E' and the numeric value fits into integer type limits (as
    defined by PHP_INT_MAX), the string will be evaluated as an
    integer. In all other cases it will be evaluated as a float.

And NEW RULE?


Previous Comments:
------------------------------------------------------------------------
[2012-05-26 11:52:09] cataphr...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2012-05-24 09:10:51] cataphr...@php.net

Automatic comment on behalf of cataphract
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=acd711685a592c52be200e248154283c6c49c9f8
Log: Fixed bug #62097

------------------------------------------------------------------------
[2012-05-23 23:59:59] s...@php.net

Automatic comment on behalf of cataphract
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=acd711685a592c52be200e248154283c6c49c9f8
Log: Fixed bug #62097

------------------------------------------------------------------------
[2012-05-22 11:00:16] cataphr...@php.net

Fixed in https://github.com/cataphract/php-src/tree/bug62097

------------------------------------------------------------------------
[2012-05-22 10:03:29] cataphr...@php.net

Ah, very well. The code is indeed wrong for 32-bit machines. I hadn't 
considered that.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=62097


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62097&edit=1

Reply via email to