Bug #65865 [Opn->Nab]: Bug in in_array function
| From: | nikic@php.net | Date: | Tue, 08 Oct 2013 18:14:00 +0000 |
| Subject: | Bug #65865 [Opn->Nab]: Bug in in_array function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182091@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65865&edit=1
ID: 65865
Updated by: nikic@php.net
Reported by: fvromera at gmail dot com
Summary: Bug in in_array function
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: Fedora 18
PHP Version: 5.5.4
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Please set the $strict argument of in_array to true. This will make a comparison with === rather
than ==. (Remember that 'normalize' == true).
Previous Comments:
------------------------------------------------------------------------
[2013-10-08 18:09:17] fvromera at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.in-array
---
If execute the following command:
var_dump(in_array('normalize', array('text', true)));
I get the function in_array are returning true, when not 'normalize' present in the array
array('text', true);
Test script:
---------------
<?php
if (in_array('normalize', array('text', true))) {
echo 'I have a bug';
} else {
echo 'All is OK';
}
?>
Expected result:
----------------
All is OK
Actual result:
--------------
I have a bug
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65865&edit=1