ID:               50307
 Updated by:       j...@php.net
 Reported By:      dsysko at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Ubuntu 9.10: 2.6.28-16 x64
 PHP Version:      5.3.1
 New Comment:

Try var_dump($arrChoices); in that function. Then figure out what magic
could bring the array in the function scope..


Previous Comments:
------------------------------------------------------------------------

[2009-11-26 08:29:32] dsysko at gmail dot com

Description:
------------
A pre-defined array passed to in_array() within switch{case(
interpreted as NULL for both flat and multi-dimensional arrays.

php config:
Configure Command =>  './configure'  '--with-openssl' '--with-pgsql'
'--with-tidy' '--with-zlib' '--with-curl' '--with-apxs2=/usr/sbin/apxs'
'--with-gd' '--with-png-dir=/usr' '--with-jpeg-dir=/usr'
'--with-freetype-dir=/usr' '--with-zlib-dir=/usr'


Reproduce code:
---------------
$arrChoices = array('numberfood' => array('apple','pie',5) , 'monkeys'
=> array('frank','chimpanzee'));
function notArraysWhat ($i) {
   switch ($i) {
      case (in_array($i , $arrChoices['numberfood'])):
         echo "$i is either a number or a food.\n";
         break;
      case (in_array($i , $arrChoices['monkeys'])):
         echo "$i is a monkey, or smells like one.\n";
         break;
   }
}
notArraysWhat('pie');

Expected result:
----------------
STDOUT: pie is either a number or a food.

Actual result:
--------------
STDOUT: Warning: in_array() expects parameter 2 to be array, null given
in /export/servers/ETG/ContentCollection/cc/testing.php on line


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


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

Reply via email to