Edit report at http://bugs.php.net/bug.php?id=53117&edit=1

 ID:                 53117
 Updated by:         cataphr...@php.net
 Reported by:        dukeofgaming at gmail dot com
 Summary:            Assignment by reference within assignment operator
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            *Compile Issues
 Operating System:   Any (Windows 7)
 PHP Version:        5.2.14
 Block user comment: N

 New Comment:

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 "=".


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to