From: japril78 at hotmail dot com Operating system: WinXP Pro PHP version: 4.3.4 PHP Bug Type: Variables related Bug description: Variable Variables don't work properly with Arrays
Description: ------------ The does not work as expected: $array = array('one','two','three'); $arraypath = 'array[1]'; echo ${$arraypath}; Workaround: $array = array('one','two','three'); $arraypath = 'myarray[1]'; eval('$value = $'.$arraypath.';'); echo $value; BUT: The workaround DOES NOT work inside a function. Reproduce code: --------------- $array = array('one','two','three'); $arraypath = 'array[1]'; $value = showit($arraypath); function showit($arraypath) { eval('$value = $'.$arraypath.';'); echo $value; // Attempt #1 echo $$arraypath; // Attempt #2 echo ${$arraypath}; // Attempt #3 } Expected result: ---------------- nothing Actual result: -------------- nothing -- Edit bug report at http://bugs.php.net/?id=26747&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26747&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26747&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26747&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26747&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26747&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=26747&r=needscript Try newer version: http://bugs.php.net/fix.php?id=26747&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26747&r=support Expected behavior: http://bugs.php.net/fix.php?id=26747&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26747&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26747&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26747&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26747&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26747&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26747&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26747&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26747&r=float