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

From: Date: Wed, 20 Oct 2010 20:15:13 +0000
Subject: Bug #53117 [Opn->Bgs]: Assignment by reference within assignment operator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155384@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
 Updated by:         cataphract@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


Thread (6 messages)

« previous php.bugs (#155384) next »