Edit report at http://bugs.php.net/bug.php?id=52928&edit=1
ID: 52928
Comment by: weishj at qq dot com
Reported by: M8R-nheyum at mailinator dot com
Summary: Segfault using parent::_construct
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: CentOS release 4.8
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
If the parent class is not defined, it also end up with segmentation
fault.
<?php
class base {
function __construct(){
call_user_func(array($this,'parent::__construct'));
}
}
class demo extends base{
function __construct(){
parent::__construct();
}
}
$z = new demo;
?>
Previous Comments:
------------------------------------------------------------------------
[2010-09-27 04:24:04] [email protected]
Stack overflow on Windows, trunk.
------------------------------------------------------------------------
[2010-09-27 02:26:56] [email protected]
This is causing an infinite recursion, but works fine on 5.2.15-dev.
------------------------------------------------------------------------
[2010-09-27 01:14:54] M8R-nheyum at mailinator dot com
Description:
------------
When calling parent::__construct using call_user_func_array, a segfault
occurs.
Script to reproduce attached below.
This worked in 5.2.14.
Expected: instantiation of class
Actual: segfault
Notes: Only occurs with multiple nesting levels. A single level doesn't
cause
this.
Test script:
---------------
<?
class baseA{
function foo(){
return 'bar';
}
function __construct(){
foo();
}
}
class baseB extends baseA {
function __construct(){
$args = func_get_args();
call_user_func_array(array($this, 'parent::__construct'),
$args);
}
}
class demo extends baseB{
function __construct(){
$args = func_get_args();
call_user_func_array(array($this, 'parent::__construct'),
$args);
}
}
$z = new demo('d');
?>
Expected result:
----------------
instantiation of class
Actual result:
--------------
segfault.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52928&edit=1