php.net |  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:
 [2004-03-31 22:42 UTC] php at mirzabah dot com
Description:
------------
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:
---------------
<html>
	<head><title>Ref Test</title></head>
	<body>
		<h1>Ref Test</h1>
		<?
		$a = 6 ;
		echo "<p>{$a}</p>\n" ;
		$a =& modify ($a) ;
		echo "<p>{$a}</p>\n" ;
		$a =& modify ($a) ;
		?>
	</body>
</html><?
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-01 12:37 UTC] iliaa@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 25 07:02:14 2014 UTC