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

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

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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