Bug #63087 [Opn]: Passing a reference to a function does not work when parentheses are used
| From: | laruence@php.net | Date: | Fri, 14 Sep 2012 09:45:55 +0000 |
| Subject: | Bug #63087 [Opn]: Passing a reference to a function does not work when parentheses are used | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173438@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63087&edit=1
ID: 63087
Updated by: laruence@php.net
Reported by: charlie at charliesomerville dot com
Summary: Passing a reference to a function does not work when
parentheses are used
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: master-Git-2012-09-14 (Git)
Block user comment: N
Private report: N
New Comment:
yes, this is a knew issue, the similar thing will also happen while you use '@';
you will get a STRICT WARNING about this. right?
I'd like mark this as wont'fix, it's a compiler issue, fix this is expensive
Previous Comments:
------------------------------------------------------------------------
[2012-09-14 07:01:04] charlie at charliesomerville dot com
Description:
------------
To be specific, this only occurs when passing a reference returned by a function
into another function that takes a reference.
This behaves as expected with a variable instead of a function call, so I believe
this is a bug.
Test script:
---------------
<?php
function &return_a() {
global $a;
return $a;
}
$a = [1,2,3];
array_shift(return_a());
print_r($a);
$a = [1,2,3];
array_shift((return_a()));
print_r($a);
Expected result:
----------------
Array
(
[0] => 2
[1] => 3
)
Array
(
[0] => 2
[1] => 3
)
Actual result:
--------------
Array
(
[0] => 2
[1] => 3
)
Array
(
[0] => 1
[1] => 2
[2] => 3
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63087&edit=1