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

 ID:                 62097
 Updated by:         cataphr...@php.net
 Reported by:        kazuo at o-ishi dot jp
 Summary:            New behavior of string == has a compatibility
                     problem
 Status:             Wont fix
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Gentoo Linux
 PHP Version:        5.4.4RC1
 Block user comment: N
 Private report:     N

 New Comment:

On a closer look, what's mentioned in the e-mail is not exactly the same thing 
because I was comparing a "always string" comparison and a string comparison as 
a fallback to a float comparison.

In any case, the problem you're mentioning could only be solved by a custom 
comparison function, a solution that was not favored in this discussion.


Previous Comments:
------------------------------------------------------------------------
[2012-05-21 23:05:11] cataphr...@php.net

Thanks for your report.

I raised this issue in internals:

http://www.mail-archive.com/internals@lists.php.net/msg58598.html
(see near the end)

and this was deemed a "very narrow use case".

So I'm marking this Wont Fix now, but feel free to take this issue to the 
internals mailing list.

------------------------------------------------------------------------
[2012-05-21 17:09:25] kazuo at o-ishi dot jp

Description:
------------
The behavior of string comparison using == operator is changed in
https://github.com/php/php-src/commit/47db8a9aa19f6e17a1018becf9978315c79a1cb0
to fix bug #54547.

This change has a compatibility problem.

Before this change (PHP 5.4.3),

  "01234" == "1234"
    => TRUE (OK)

  "09223372036854775808" == "9223372036854775808"
    => TRUE (compared as float, but result is acceptable)

After change,

  "01234" == "1234"
    => TRUE (OK)

  "09223372036854775808" == "9223372036854775808"
    => FALSE (compared as string)

This behavior is not reasonable in that case.
New rule is not clear.

I think this change should be reverted, before release of 5.4.4.


Test script:
---------------
echo (("01234" == "1234") ? "true" : "false"), "\n";
echo (("09223372036854775808" == "9223372036854775808") ? "true" : "false"), 
"\n";


Expected result:
----------------
true
true


Actual result:
--------------
true
false


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



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

Reply via email to