#39788 [NEW]: in_array don't return false or true
| From: | roberto at spadim dot com dot br | Date: | Sun, 10 Dec 2006 13:26:11 +0000 |
| Subject: | #39788 [NEW]: in_array don't return false or true | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-106163@lists.php.net to get a copy of this message | ||
From: roberto at spadim dot com dot br
Operating system: ALL
PHP version: 5.2.0
PHP Bug Type: Arrays related
Bug description: in_array don't return false or true
Description:
------------
RETURN NULL?!?! see documentation
http://br.php.net/manual/pt_BR/function.in-array.php
just can return TRUE or FALSE! NULL isn't allowed!
see that i'm using 4 parameters and no error was showed
Reproduce code:
---------------
<?php
$images=array(
"cabec0" => "cabec0", "cabec1" => "cabec1",
"cabec2" => "cabec2", "cabec3" => "cabec3",
"cabec4" => "cabec4",
"login0" => "login0", "login1" => "login1",
"login2" => "login2", "login3" => "login3",
"login4" => "login4",
"messenger0" => "messenger0", "messenger1" =>
"messenger1",
"messenger2" => "messenger2", "messenger3" =>
"messenger3",
"messenger4" => "messenger4",
"file_explorer0" => "explorer0","file_explorer1" =>
"explorer1",
"file_explorer2" => "explorer2","file_explorer3" =>
"explorer3",
"file_explorer4" => "explorer4",
"yellow"=>"yellow","red"=>"red",
"gray"=>"gray","blue"=>"blue","green"=>"green",
"logo" => "logo.png", "smm" => "smm.gif"
);
$image='rodape';
var_dump(in_array($image,'logo','rodape','smm'));
print_r($images);
?>
Expected result:
----------------
FALSE
Actual result:
--------------
NULL
--
Edit bug report at http://bugs.php.net/?id=39788&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39788&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39788&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39788&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39788&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39788&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39788&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39788&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39788&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39788&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39788&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39788&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39788&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39788&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39788&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39788&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39788&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39788&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39788&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39788&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39788&r=mysqlcfg