PHP-Daemon icon indicating copy to clipboard operation
PHP-Daemon copied to clipboard

Dead worker causing PHP Fatal error: Call to a member function teardown() on a non-object

Open JaredBoone opened this issue 10 years ago • 0 comments

If a worker process dies for some reason then after the timeout interval Daemon::__destruct() calls teardown() on a null object. The result is PHP Fatal error: Call to a member function teardown() on a non-object. This could be handled gracefully by checking that the worker object is non-null before calling teardown().

Bug:

$this->{$object}->teardown();
unset($this->{$object});

Solution:

if(isset($this->{$object})){
    $this->{$object}->teardown();
    unset($this->{$object});
}

JaredBoone avatar Sep 17 '14 05:09 JaredBoone