Edit report at https://bugs.php.net/bug.php?id=62763&edit=1

 ID:                 62763
 Comment by:         valentiny510 at yahoo dot es
 Reported by:        valentiny510 at yahoo dot es
 Summary:            register_shutdown_function and extending class
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   XP
 PHP Version:        5.4.5
 Block user comment: N
 Private report:     N

 New Comment:

P.S. The functions both "exit" and with "echo" I got this errors:

[06-Aug-2012 23:48:50 UTC] PHP Warning:  (Registered shutdown functions) Unable 
to call test1::shutdown() - function does not exist in Unknown on line 0

[06-Aug-2012 23:48:50 UTC] PHP Warning:  (Registered shutdown functions) Unable 
to call test2::shutdown() - function does not exist in Unknown on line 0


Previous Comments:
------------------------------------------------------------------------
[2012-08-06 22:20:04] valentiny510 at yahoo dot es

Description:
------------
Is a little hard to explain becouse are many scenarios where the shutdown 
function fail or the php doesn't handle correctly the errors but the most 
simplest method is shown bellow.

Normally, without the register_shutdown_function works well, but if I add the 
function into the __construct and the child class does not have defined the 
__construct then fail.

To work well I need to add the __construct function to the child, but if I 
dont, why the php doesnt throw me an error with $file, $line etc ?

I have many scripts and different scenarios where fail but this I think is the 
worst becouse it crush all the server.

Sorry but I cant provide any backtrace in this moment

Test script:
---------------
class test1 {
    public function __construct() {
        register_shutdown_function(array($this, 'shut')); }
    public function shutdown() { exit ('Shutdown'); }
}

class test2 extends test1 {
    public function __destruct() { exit (__METHOD__); }
}

new test1;
new test2;


Expected result:
----------------
test2::__destruct
Shutdown

or

Shutdown
test2::__destruct

depending of the priority

Actual result:
--------------
All server crush and restart



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62763&edit=1

Reply via email to