|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-06-10 09:21 UTC] nikic@php.net
[2015-06-10 09:43 UTC] artur at salonstron dot pl
[2015-06-10 09:49 UTC] nikic@php.net
[2015-06-10 10:10 UTC] artur at salonstron dot pl
[2015-06-10 10:14 UTC] artur at salonstron dot pl
[2015-06-10 11:14 UTC] artur at salonstron dot pl
[2017-10-19 21:35 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2017-10-19 21:35 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 05:00:01 2025 UTC |
Description: ------------ In the example below, the variable $d is assigned a reference to a local variable $a (in function test) despite the fact that variable was not returns by reference. To fix this, you must either before returning the $a use the reset(), or inside test() use another variable. Test script: --------------- <?php $a = array ( 1=>"a", 2=>"b", 3=>"c" ); $d = test($a); echo "d:<br />"; while(list($key, $val)=each($d)) { echo $val." "; } function test($a) { while(list($key, $val)=each($a)) { $a[$key] = $val . "t3"; } return $a; } Expected result: ---------------- d: at3 bt3 ct3 Actual result: -------------- d: