#25410 [Opn->Csd]: strange crash & freeze bug when reassigning global var to method's return
| From: | sniper@php.net | Date: | Sun, 07 Sep 2003 15:11:02 +0000 |
| Subject: | #25410 [Opn->Csd]: strange crash & freeze bug when reassigning global var to method's return | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-47179@lists.php.net to get a copy of this message | ||
ID: 25410
Updated by: sniper@php.net
Reported By: xuefer at 21cn dot com
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: win
PHP Version: 4.3.3
New Comment:
Fixed in PHP 5. (ZE2, won't fix in PHP 4)
Previous Comments:
------------------------------------------------------------------------
[2003-09-07 06:13:39] 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;
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25410&edit=1