php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25410 strange crash & freeze bug when reassigning global var to method's return
Submitted: 2003-09-07 06:13 UTC Modified: 2003-09-07 11:11 UTC
From: xuefer at 21cn dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.3 OS: win
Private report: No CVE-ID: None
 [2003-09-07 06:13 UTC] xuefer at 21cn dot com
Description:
------------
the 1st code make apache crash, and the 2nd make apache freeze, taking full cpu usage
notice that the "exit" statement is important
noting will happend when "exit" is removed

only class methods is affected, not function


Reproduce code:
---------------
crash:
<?php

class A
{
	function &getInstance()
	{
		if (empty($GLOBALS['a'])) {
			$GLOBALS['a'] = &new A();
		}
		return $GLOBALS['a'];
	}
}

$a = &A::getInstance();
exit;

?>

freeze:
<?php

class A
{
	function &getInstance()
	{
		return $GLOBALS['a'];
	}
}

$a = &A::getInstance();
exit;

?>



Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-07 11:11 UTC] sniper@php.net
Fixed in PHP 5. (ZE2, won't fix in PHP 4)



 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 01:01:28 2024 UTC