Bug #62097 [NEW]: New behavior of string == has a compatibility problem

From: Date: Mon, 21 May 2012 17:09:25 +0000
Subject: Bug #62097 [NEW]: New behavior of string == has a compatibility problem
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170643@lists.php.net to get a copy of this message
From:             
Operating system: Gentoo Linux
PHP version:      5.4.4RC1
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:New behavior of string == has a compatibility problem

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 bug report at https://bugs.php.net/bug.php?id=62097&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=62097&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=62097&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=62097&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=62097&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62097&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=62097&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=62097&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=62097&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=62097&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=62097&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=62097&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=62097&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=62097&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=62097&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=62097&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62097&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=62097&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=62097&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=62097&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=62097&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=62097&r=mysqlcfg



Thread (26 messages)

« previous php.bugs (#170643) next »