ID: 43179
User updated by: php at lorddeath dot net
Reported By: php at lorddeath dot net
Status: Open
Bug Type: Reproducible crash
Operating System: Windows / Linux
PHP Version: 5.2.4
New Comment:
Sorry; got the code wrong. This, however, segfaults as "expected":
<?
class MC {
public $Vars = array();
public function Execute() {
foreach ($this->Vars as $k => $v) { $$k = $v; }
$MyArr['Var'] = $MyArr;
$MC = new MC();
$MC->Vars = $MyArr;
$MC->Execute();
}
}
$MyArr = array();
$MyArr['Var'] = $MyArr;
$MC = new MC();
$MC->Vars = $MyArr;
$MC->Execute();
echo "Hello world.";
?>
Previous Comments:
------------------------------------------------------------------------
[2007-11-02 15:55:46] php at lorddeath dot net
Description:
------------
When the code I've supplied is executed, PHP crashes, leaving a
segfault message in Apache's log.
The code looks a little perverse, though a variation on it had a real
use in my situation, but regardless, PHP shouldn't segfault, no matter
how perverse the code is :)
Reproduce code:
---------------
class MC {
public $Vars = array();
public function Execute() {
if (!defined('DONE')) {
define('DONE', true);
foreach ($this->Vars as $k => $v) { $$k = $v; }
$MyArr['Var'] = $MyArr;
$MC = new MC();
$MC->Vars = $MyArr;
$MC->Execute();
}
}
}
$MyArr = array();
$MyArr['Var'] = $MyArr;
$MC = new MC();
$MC->Vars = $MyArr;
$MC->Execute();
echo "Hello world.";
Expected result:
----------------
"Hello world." should be printed.
Actual result:
--------------
Nothing is printed, and a segfault line is added to
/var/log/apache2/error.log:
[Fri Nov 02 15:50:11 2007] [notice] child pid 23282 exit signal
Segmentation fault (11)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43179&edit=1