Edit report at https://bugs.php.net/bug.php?id=63087&edit=1
ID: 63087 Updated by: larue...@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