From:             ludko2 at gmail dot com
Operating system: win7 64bit
PHP version:      5.4.12
Package:          *Programming Data Structures
Bug Type:         Bug
Bug description:Comparison does not return correct value

Description:
------------
Comparison between string and zero and string returns true?!?

var_dump("b0180e6574921b8b8de3c40bfd046571"==0);

tested on 5.4.6 win 7 64bit

Test script:
---------------
$arr = array("0"=>"b");
var_dump($arr);//array(1) {  [0]=>  string(1) "b"}
foreach($arr as $k=>$v){
   var_dump($k == "c"); // returns true (FAIL)
}
var_dump("b"==0);//returns true (FAIL)

var_dump("a"==1); // returns false (OK)

Expected result:
----------------
var_dump("b"==0);// expecting false


Actual result:
--------------
var_dump("b"==0);// returning true


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

Reply via email to