|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27819 Returning a reference to a reference parameter more than once causes crash
Submitted: 2004-03-31 22:42 UTC Modified: 2004-04-01 12:37 UTC
From: php at mirzabah dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.3.4 OS: Windows XP
Private report: No CVE-ID: None
 [2004-03-31 22:42 UTC] php at mirzabah dot com
If a variable is passed by reference to a function that returns it as a reference more than once, PHP will hang then crash on exit. I'm guessing it's some kind of garbage collection problem...

Reproduce code:
	<head><title>Ref Test</title></head>
		<h1>Ref Test</h1>
		$a = 6 ;
		echo "<p>{$a}</p>\n" ;
		$a =& modify ($a) ;
		echo "<p>{$a}</p>\n" ;
		$a =& modify ($a) ;
function &modify (&$thing)
	$thing += 1 ;
	return $thing ;

Expected result:
I expect PHP to exit cleanly upon completion of the script.

Actual result:
When the script finishes execution, it hangs and eventually crashes. Note that the function returns cleanly as often as you call it. The hang only occurs once the script has completed.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-01 12:37 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Dec 05 03:01:26 2023 UTC