#20953 [Fbk->Opn]: error when combing ?: and return by reference

From: Date: Thu, 12 Dec 2002 15:11:51 +0000
Subject: #20953 [Fbk->Opn]: error when combing ?: and return by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-27488@lists.php.net to get a copy of this message
 ID:               20953
 User updated by:  minakov@bas-net.by
 Reported By:      minakov@bas-net.by
-Status:           Feedback
+Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Windows NT 5.1 build 2600
-PHP Version:      4.2.3
+PHP Version:      4.4.0-dev
 New Comment:

I tried it - it does not work as well.


Previous Comments:
------------------------------------------------------------------------

[2002-12-12 05:52:17] sniper@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

------------------------------------------------------------------------

[2002-12-12 04:29:28] minakov@bas-net.by

let the sample code say the problem
<?

function &Ref_Bad(&$arr) { return true ? $arr : $arr; }
function &Ref_Good(&$arr) { if (true) return $arr; else return $arr; }

$arr = array('a' => '1');

$arr_bad =& Ref_Bad($arr);
$arr_good =& Ref_Good($arr);

$arr_bad['b'] = 2;
$arr_good['c'] = 3;

print_r($arr);
?>

required result:
Array
(
    [a] => 1
    [b] => 2
    [c] => 3
)

current result:
Array
(
    [a] => 1
    [c] => 3
)


------------------------------------------------------------------------


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



Thread (5 messages)

« previous php.bugs (#27488) next »