|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-11-22 10:05 UTC] tom at tomwardrop dot com
Description:
------------
If class B, extends Class A, and class B calls Class A's constructor in its own contructor by using call_user_func("parent", "__construct"), and if class A's constructor is defined as the class name rather than "__construct", then PHP seems to crash (which results in Apache 2 crashing). Problem still exists with all extensions disabled.
Reproduce code:
---------------
<?php
class testClass
{
function testClass ()
{
echo 'Output string!';
}
}
class testClass2 extends testClass
{
function __construct ()
{
call_user_func(array('parent', '__construct'));
}
}
new testClass2;
?>
Expected result:
----------------
The above code should echo out the string 'Output string!'. This code works correctly when "call_user_func" or "call_user_func_array" are not used.
Actual result:
--------------
call_user_func() and call_user_func_array(), cause PHP and as a result, Apache 2 to crash. When running PHP DBG debugger, the crash happens on the execution of call_user_func() line. The Windows event log notes that httpd.exe (apache) had crashed, blaming php5ts.dll for the fault.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
To clarify, replacing... call_user_func(array('parent', '__construct')); ...with... parent::__construct(); ...works as expected, hence it's definitely a problem with the "call_user_func" and "call_user_func_array" functions.