|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-03-24 01:45 UTC] brunswim at seas dot upenn dot edu
[2003-03-24 03:41 UTC] sniper@php.net
[2003-03-24 04:29 UTC] moriyoshi@php.net
[2003-03-24 11:39 UTC] brunswim at seas dot upenn dot edu
[2003-03-25 17:41 UTC] jseverson at myersinternet dot com
[2003-07-29 12:57 UTC] iliaa@php.net
[2003-07-30 11:53 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 12:00:02 2025 UTC |
f() returns a reference to an uninitialized variable $a. In subsequent calls, this appears to corrupt the local variable $x. The following script demonstrates the problem. <? function &f() { $x = "foo"; var_dump($x); print "<br>\n$x<br>\n"; return($a); } for ($i = 0; $i < 8; $i++) { $h =& f(); } ?> On the third call to f(), $x prints fine but is reported to be NULL by var_dump(). Operations on $x will subsequently cause unexpected behavior. We can change the behavior of $x by adding the line: $y = "bar"; after the line: $x = "foo"; If we do this, printing $x returns "bar" but var_dump() still returns NULL.