PHP-Daemon
PHP-Daemon copied to clipboard
Dead worker causing PHP Fatal error: Call to a member function teardown() on a non-object
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});
}