From: xamine at gmail dot com
Operating system: FreeBSD and WIN
PHP version: 5.2.6
PHP Bug Type: Strings related
Bug description: logic related; "abc"==0 returns true
Description:
------------
I think there is a bug in the logic when comparing a string to int(0).
I experience this bug on both MS windows and FreeBSD, on PHP 5.2.5 and PHP
5.2.6 and using Apache 2.0 / 1.3.
Reproduce code:
---------------
//Here is three ways of reproducing the same error.
var_dump("test"==0);
var_dump(("anotherTest"==0));
//... and finaly ...
$bool=("abc"==0);
var_dump($bool);
Expected result:
----------------
I expect them all to return bool(false), I expect only "0"==0 to return
true.
Actual result:
--------------
They all return bool(true), nomather what string i compare to 0
--
Edit bug report at http://bugs.php.net/?id=45495&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45495&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45495&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45495&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45495&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45495&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45495&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45495&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45495&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45495&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45495&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45495&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45495&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45495&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45495&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45495&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45495&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45495&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45495&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45495&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45495&r=mysqlcfg