From: laurynas at by dot lt Operating system: Linux 2.6.17.7 PHP version: 5.2.1 PHP Bug Type: Arrays related Bug description: Array values destroyed after using as reference in function call
Description: ------------ Array values are destroyed after using it as reference in function call defining in call dirrectly as array. If given array is constructed before function call in the same parameters line, PHP returns nothing, but really shoud return a value associated to array. Reproduce code: --------------- <?php // this is our defined function // as you can see the second parameter is reference function someFunc($param1, & $array) { // so expecting $array as array we // put some value in it $array[0] = 'some value'; } // now call the function, please note, that array $user // is created as array type *outside* function someFunc(null, $user = array()); // now let's check returned value print_r($user); ?> Expected result: ---------------- Array ( [0] => some value ) Actual result: -------------- Array ( ) -- Edit bug report at http://bugs.php.net/?id=41242&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41242&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41242&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41242&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41242&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41242&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41242&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41242&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41242&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41242&r=support Expected behavior: http://bugs.php.net/fix.php?id=41242&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41242&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41242&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41242&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41242&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41242&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41242&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41242&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41242&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41242&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41242&r=mysqlcfg