Bug #53117 [Bgs]: Assignment by reference within assignment operator

From: Date: Wed, 20 Oct 2010 21:24:28 +0000
Subject: Bug #53117 [Bgs]: Assignment by reference within assignment operator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155387@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53117&edit=1 ID: 53117 User updated by: dukeofgaming at gmail dot com Reported by: dukeofgaming at gmail dot com Summary: Assignment by reference within assignment operator Status: Bogus Type: Bug Package: *Compile Issues Operating System: Any (Windows 7) PHP Version: 5.2.14 Block user comment: N New Comment: I am not under the impresion that there is an asign-by-reference operator as such, since one is free to separate "=" from "&", where "&" indicates return by reference. However the expression part makes this clear. Regards, David Vega Previous Comments: ------------------------------------------------------------------------ [2010-10-20 22:15:12] cataphract@php.net This is not a bug. The ternary operator defines an expression. Even if it allowed yielding a reference (it doesn't), you are not assigning by reference in $my_var = ... The assign by reference operator is "=&", not "=". ------------------------------------------------------------------------ [2010-10-20 18:53:06] dukeofgaming at gmail dot com Description: ------------ Hi, PHP throws a fatal error when code like this is processed: $my_var = (true)?(&$some_obj):(&$some_other_obj->some_arr_pop[]); Which is not a problem if put like this of course: $my_var; if(true){ $my_var = &$some_obj; }else{ $my_var = &$some_other_obj->some_arr_pop[]; } Affects both PHP 5.2.x and 5.3.x ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53117&edit=1

« previous php.bugs (#155387) next »