Bug #52336 [NEW]: You can't use multidimensional arrays in functions which support arrays.

From: Date: Wed, 14 Jul 2010 11:53:11 +0000
Subject: Bug #52336 [NEW]: You can't use multidimensional arrays in functions which support arrays.
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-4686@lists.php.net to get a copy of this message
From: Operating system: Windows + Linux PHP version: Irrelevant Package: Documentation problem Bug Type: Bug Bug description:You can't use multidimensional arrays in functions which support arrays. Description: ------------ The documentation for functions like str_replace says, that you can use an array as subject. Multidimensional arrays are not excluded, but if you use them nothing happens. This bug is reproducable with ALL functions which should support the use of array. If this is wanted behaviour you should edit the documentation. Test script: --------------- $testarray = array(array('bla', 'blub'),array('blub', 'bla')); $testarray = str_replace('bla', 'blub', $testarray); //doesn't work print_r($testarray); echo('<br>'); for($i=0; $i<count($testarray); $i++) { $testarray[$i] = str_replace('bla', 'blub', $testarray[$i]); //works } print_r($testarray); Expected result: ---------------- -only array output of 'blub' Actual result: -------------- Array ( [0] => Array ( [0] => bla [1] => blub ) [1] => Array ( [0] => blub [1] => bla ) ) Array ( [0] => Array ( [0] => blub [1] => blub ) [1] => Array ( [0] => blub [1] => blub ) ) -- Edit bug report at http://bugs.php.net/bug.php?id=52336&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52336&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52336&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52336&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52336&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52336&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52336&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52336&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52336&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52336&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52336&r=support Expected behavior: http://bugs.php.net/fix.php?id=52336&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52336&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52336&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52336&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52336&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52336&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52336&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52336&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52336&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52336&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52336&r=mysqlcfg

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