php - Does register_shutdown_function() get called before or after the response is echoed? -
i writing phalcon php application. in it, register shutdown function in constructor of class:
public function __construct() { register_shutdown_function([$this, 'shutdownhandler']); } public function shutdownhandler() { $this->deliverqueue(); }
whenever conditions run hold, waiting time response higher.
i made small test: when comment out deliverqueue
, response comes in 1 second. when replace line sleep(1), response comes after 5-6(!!!) seconds. when replace sleep(10), 500 error.
per documentation, expect shutdown function activate after script execution finishes, therefore after response gets echoed back.
is documentation incorrect? why happening?
yes register_shutdown_function
execute after script finishes or if attempt of exit
or if error
occurs register_shutdown_function
run
Comments
Post a Comment