Edit report at https://bugs.php.net/bug.php?id=63847&edit=1

 ID:                 63847
 Updated by:         ahar...@php.net
 Reported by:        evil0x3a at gmail dot com
 Summary:            wrong warning when using in_array() function with
                     specific parameters
-Status:             Feedback
+Status:             Not a bug
 Type:               Bug
-Package:            Scripting Engine problem
+Package:            Arrays related
 Operating System:   Linux
 PHP Version:        5.3.20
 Block user comment: N
 Private report:     N

 New Comment:

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 http://php.net/support if you need further help.


Previous Comments:
------------------------------------------------------------------------
[2012-12-26 15:37:53] re...@php.net

I can't reproduce it, will you check it again?

------------------------------------------------------------------------
[2012-12-24 10:53:38] evil0x3a at gmail dot com

Description:
------------
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 )
----------------------------
<?php

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

?>
----------------------------
file 2 ( index.php )
----------------------------
<?php
require_once('arrayFile.php');
$language = 'ar';
if(in_array($language,$languages)) 
{
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 ..."


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63847&edit=1

Reply via email to