Merge pull request #655 from flightphp/async-fix

Finally found the horrific memory leak!
master v3.16.1
n0nag0n 3 days ago committed by GitHub
commit f2b4aea5d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -521,6 +521,12 @@ class Engine
if ($this->requestHandled === false) { if ($this->requestHandled === false) {
// not doing much here, just setting the requestHandled flag to true // not doing much here, just setting the requestHandled flag to true
$this->requestHandled = true; $this->requestHandled = true;
// Allow filters to run
// This prevents multiple after events from being registered
$this->after('start', function () use ($self) {
$self->stop();
});
} else { } else {
// deregister the request and response objects and re-register them with new instances // deregister the request and response objects and re-register them with new instances
$this->unregister('request'); $this->unregister('request');
@ -535,11 +541,6 @@ class Engine
$response = $this->response(); $response = $this->response();
$router = $this->router(); $router = $this->router();
// Allow filters to run
$this->after('start', function () use ($self) {
$self->stop();
});
if ($response->v2_output_buffering === true) { if ($response->v2_output_buffering === true) {
// Flush any existing output // Flush any existing output
if (ob_get_length() > 0) { if (ob_get_length() > 0) {

Loading…
Cancel
Save