|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2015-01-26 07:00 UTC] requinix@php.net
 
-Status:  Open
+Status:  Not a bug
-Package: PHP Language Specification
+Package: Scripting Engine problem
  [2015-01-26 07:00 UTC] requinix@php.net
  [2015-01-26 20:52 UTC] steve dot piner at signify dot co dot nz
  [2015-01-26 21:17 UTC] requinix@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 09:00:01 2025 UTC | 
Description: ------------ A reference created with a foreach loop appears to survive long after the function creating the reference has exited. Test script: --------------- function f() { static $x; if(!$x) { $x = range(1, 3); } foreach($x as $i => &$j) { } return $x; } $z = f(); $y = f(); $y[2] = 'surprise'; print $z[2] . "\n"; Expected result: ---------------- 3 Actual result: -------------- surprise