From:             php at lorddeath dot net
Operating system: Windows / Linux
PHP version:      5.2.4
PHP Bug Type:     Reproducible crash
Bug description:  Segfault on combo of recursive array, class members and 
variable variables

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 bug report at http://bugs.php.net/?id=43179&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43179&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43179&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43179&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43179&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43179&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43179&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43179&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43179&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43179&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43179&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43179&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43179&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43179&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43179&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43179&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43179&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43179&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43179&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43179&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43179&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43179&r=mysqlcfg

Reply via email to