|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-09-27 01:14 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 09:00:02 2025 UTC |
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; ?>