#34795 [Asn->Bgs]: Passing assignment result by reference passes it by value
| From: | iliaa@php.net | Date: | Thu, 20 Oct 2005 14:45:54 +0000 |
| Subject: | #34795 [Asn->Bgs]: Passing assignment result by reference passes it by value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86816@lists.php.net to get a copy of this message | ||
ID: 34795
Updated by: iliaa@php.net
Reported By: tomas_matousek at hotmail dot com
-Status: Assigned
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5CVS-2005-10-09
Assigned To: dmitry
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is expected and documented behaviour.
Previous Comments:
------------------------------------------------------------------------
[2005-10-12 14:05:44] tomas_matousek at hotmail dot com
"$x =& $y" is also an expression, isn't it?
And f($x =& $y) works well.
------------------------------------------------------------------------
[2005-10-12 12:58:50] tony2001@php.net
"$u = $v = $w" is an expression, not a variable.
It's not possible to reference an expression and I don't think it can
be fixed at all.
------------------------------------------------------------------------
[2005-10-09 22:41:44] sniper@php.net
Dmitry, can you check this out?
------------------------------------------------------------------------
[2005-10-09 21:58:44] tomas_matousek at hotmail dot com
Well, the versino in CVS doesn't report an error, however it passes by
value instead which is imho also incorrect.
Example:
function f(&$x)
{
$x = 10;
}
$a = $b = $c = $d = $u = $v = $w = 1;
$b =& $z;
f($a = $b = $c);
var_dump($a,$b,$c);
f($u = $v = $w);
var_dump($u,$v,$w);
--------
prints:
int(10)
int(1)
int(1)
int(1)
int(1)
int(1)
It should print
int(10)
int(1)
int(1)
int(10)
int(1)
int(1)
------------------------------------------------------------------------
[2005-10-09 21:11:34] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/34795
--
Edit this bug report at http://bugs.php.net/?id=34795&edit=1