From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.1.0RC1 PHP Bug Type: Scripting Engine problem Bug description: Passing assignment result by reference
Description: ------------ Let's have a function with a parameter passsed by reference. function f(&$x) { } Now, call this function as follows: f($a = $b = $c); This will sometimes fail sometimes not depending on whether any of the variables $a, $b, $c has previously been used with =& operator. In a such case, the call succeeds with $a being aliased to $x. Otherwise, fatal error occures: "Only variables can be passed by reference". this code works: $b =& $z; f($a = $b = $c); this code doesn't: f($a = $b = $c); So the "correctness" of the code depends on whether there exists an alias of one of the variable. That's weird, isn't it? Reproduce code: --------------- $b =& $z; f($a = $b = $c); f($u = $v = $w); Expected result: ---------------- OK. OK. - or - Error. Error. Actual result: -------------- OK. Error. -- Edit bug report at http://bugs.php.net/?id=34795&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34795&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34795&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34795&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34795&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34795&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34795&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34795&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34795&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34795&r=support Expected behavior: http://bugs.php.net/fix.php?id=34795&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34795&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34795&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34795&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34795&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34795&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34795&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34795&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34795&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34795&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34795&r=mysqlcfg