Doc #54574 [NEW]: is_array doesn't have any warning about unexpected type casting

From: Date: Wed, 20 Apr 2011 04:21:33 +0000
Subject: Doc #54574 [NEW]: is_array doesn't have any warning about unexpected type casting
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6267@lists.php.net to get a copy of this message
From: Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:is_array doesn't have any warning about unexpected type casting Description: ------------ Consider: $safeColors = array(1,2,3,4,5,6,7,8,9,0,'a','b','c','d','e','f'); var_dump(in_array('T', $safeColors)); People not paying attention would assume "false", however, because T is compared with integers, it seems to be cast to 0, therefore, outputting true. A "solution" would be a warning on the in_array page, as this isn't a problem with the function, just something that confuses users who aren't expecting it. -- Edit bug report at http://bugs.php.net/bug.php?id=54574&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54574&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54574&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54574&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54574&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54574&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54574&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54574&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54574&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54574&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54574&r=support Expected behavior: http://bugs.php.net/fix.php?id=54574&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54574&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54574&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54574&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54574&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54574&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54574&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54574&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54574&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54574&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54574&r=mysqlcfg

« previous php.doc.bugs (#6267) next »