#49167 [Opn->Bgs]: Bug in in_array() function
| From: | jani@php.net | Date: | Wed, 05 Aug 2009 07:53:30 +0000 |
| Subject: | #49167 [Opn->Bgs]: Bug in in_array() function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-140671@lists.php.net to get a copy of this message | ||
ID: 49167
Updated by: jani@php.net
Reported By: dos at null-squad dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: CentOS
PHP Version: 5.3.0
New Comment:
It's same as this: "a" == true. Which you fix with "a" === true.
Use the 3rd param, Luke. RTFM: http://php.net/in_array
Previous Comments:
------------------------------------------------------------------------
[2009-08-05 07:43:08] dos at null-squad dot com
Description:
------------
in_array() returns true for in_array('a', array('a'=>true)) instead of
false.
Reproduce code:
---------------
var_dump(
in_array(
'a',
array('a'=>true)
)
);
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49167&edit=1