ID: 50261 Updated by: j...@php.net Reported By: tom at tomwardrop dot com -Status: Open +Status: Verified Bug Type: Reproducible crash -Operating System: Windows 7 x64 +Operating System: * -PHP Version: 5.3.1 +PHP Version: 5.3, 6 New Comment:
In PHP_5_2 you get this error and no crash: Warning: call_user_func(parent::__construct): First argument is expected to be a valid callback.. Previous Comments: ------------------------------------------------------------------------ [2009-11-22 10:08:22] tom at tomwardrop dot com 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. ------------------------------------------------------------------------ [2009-11-22 10:05:54] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50261&edit=1