From: realbaziak at gmail dot com
Operating system: Gentoo Linux
PHP version: 5.2.6
PHP Bug Type: Arrays related
Bug description: A bug then using equality operator ("==") to compare arrays
Description:
------------
Equality operator returns true, though arrays are different.
Is it a bug or feature? :)
Thanks.
Reproduce code:
---------------
$a = array(0 => "something");
$b1 = array(0 => "another");
$b2 = array(0 => "0");
$b3 = array(0 => null);
$b4 = array(0 => 0);
$a2 = array(0 => "two", 1 => "elements");
$b5 = array(0 => 0, 1 => 0);
var_dump($a == $b1); // bool(false)
var_dump($a == $b2); // bool(false)
var_dump($a == $b3); // bool(false)
var_dump($a == $b4); // bool(true) -- why array(0 => "something")
// equals to array(0 => 0)?
var_dump($a2 == $b5); // bool(true) -- it seems there are some regularity
Expected result:
----------------
always bool(false)
Actual result:
--------------
bool(true) on something like
array(0 => "one", 1 => "two") == array(0 => 0, 1 => 0)
--
Edit bug report at http://bugs.php.net/?id=46640&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46640&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46640&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46640&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=46640&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=46640&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=46640&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=46640&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=46640&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=46640&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=46640&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=46640&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46640&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46640&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=46640&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46640&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46640&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=46640&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=46640&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=46640&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=46640&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=46640&r=mysqlcfg