From:             evil0x3a at gmail dot com
Operating system: Linux
PHP version:      5.3.20
Package:          Compile Warning
Bug Type:         Bug
Bug description:wrong warning when using in_array() function with specific 
parameters

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 bug report at https://bugs.php.net/bug.php?id=63847&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63847&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63847&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63847&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63847&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63847&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63847&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63847&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63847&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63847&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63847&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63847&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63847&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63847&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63847&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63847&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63847&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63847&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63847&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63847&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63847&r=mysqlcfg

Reply via email to