|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-26 10:01 UTC] jani@php.net
[2010-12-20 12:50 UTC] jani@php.net
-Package: Tidy
+Package: Scripting Engine problem
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 09:00:01 2025 UTC |
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