|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63847 wrong warning when using in_array() function with specific parameters
Submitted: 2012-12-24 10:53 UTC Modified: 2013-01-08 03:19 UTC
From: evil0x3a at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.3.20 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: evil0x3a at gmail dot com
New email:
PHP Version: OS:


 [2012-12-24 10:53 UTC] evil0x3a at gmail dot com
in_array() function cannot deal with an array that has been declared in an 
included script  , and the compiler shows ths warning :
"PHP Warning:  in_array() expects parameter 2 to be array, null given in ..."

Test script:
we have 2 files 
file 1 ( arrayFile.php )

$languages = array('en','fr','es','it','ar','in','ru','jp');

file 2 ( index.php )
$language = 'ar';
print "200 OK";
} else {
print "404 not found";

Expected result:
i expect that in_array() function returns true while the value of $language is available in $languages directory !

Actual result:
Returns nothing and provides this warning :
"PHP Warning:  in_array() expects parameter 2 to be array, null given in ..."


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-26 15:37 UTC]
I can't reproduce it, will you check it again?
 [2012-12-26 15:37 UTC]
-Status: Open +Status: Feedback -Package: Compile Warning +Package: Scripting Engine problem
 [2013-01-08 03:19 UTC]
Works fine here. You have some other problem, most likely with your require_once — check your error reporting settings and try one of the support channels at if you need further help.
 [2013-01-08 03:19 UTC]
-Status: Feedback +Status: Not a bug -Package: Scripting Engine problem +Package: Arrays related
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 29 07:01:23 2020 UTC