From: xuefer at 21cn dot com
Operating system: win
PHP version: 4.3.3
PHP Bug Type: Scripting Engine problem
Bug description: strange crash & freeze bug when reassigning global var to method's
return
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 bug report at http://bugs.php.net/?id=25410&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25410&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25410&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25410&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25410&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25410&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25410&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25410&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25410&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25410&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25410&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25410&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25410&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25410&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25410&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25410&r=gnused