#45495 [Opn->Bgs]: logic related; "abc"==0 returns true
| From: | felipe@php.net | Date: | Sat, 12 Jul 2008 17:54:15 +0000 |
| Subject: | #45495 [Opn->Bgs]: logic related; "abc"==0 returns true | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126574@lists.php.net to get a copy of this message | ||
ID: 45495
Updated by: felipe@php.net
Reported By: xamine at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: FreeBSD and WIN
PHP Version: 5.2.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
See http://docs.php.net/manual/en/types.comparisons.php
Previous Comments:
------------------------------------------------------------------------
[2008-07-12 17:33:37] xamine at gmail dot com
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 this bug report at http://bugs.php.net/?id=45495&edit=1