php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20953 error when combing ?: and return by reference
Submitted: 2002-12-12 04:29 UTC Modified: 2003-01-02 18:46 UTC
Votes:10
Avg. Score:4.6 ± 0.7
Reproduced:9 of 9 (100.0%)
Same Version:4 (44.4%)
Same OS:4 (44.4%)
From: minakov at bas-net dot by Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.4.0-dev OS: Windows NT 5.1 build 2600
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-12-12 04:29 UTC] minakov at bas-net dot 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
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-12 05:52 UTC] 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 09:11 UTC] minakov at bas-net dot by
I tried it - it does not work as well.
 [2002-12-12 11:19 UTC] sniper@php.net
Just curious..exactly what practical use has this??
Could you give us some real world example instead..?

 [2003-01-02 18:46 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Nov 27 18:03:43 2022 UTC