Skip to content

Commit 3d8149a

Browse files
committed
Finally found the horrific memory leak!
1 parent d43f2e9 commit 3d8149a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

flight/Engine.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ public function _start(): void
521521
if ($this->requestHandled === false) {
522522
// not doing much here, just setting the requestHandled flag to true
523523
$this->requestHandled = true;
524+
525+
// Allow filters to run
526+
// This prevents multiple after events from being registered
527+
$this->after('start', function () use ($self) {
528+
$self->stop();
529+
});
524530
} else {
525531
// deregister the request and response objects and re-register them with new instances
526532
$this->unregister('request');
@@ -535,11 +541,6 @@ public function _start(): void
535541
$response = $this->response();
536542
$router = $this->router();
537543

538-
// Allow filters to run
539-
$this->after('start', function () use ($self) {
540-
$self->stop();
541-
});
542-
543544
if ($response->v2_output_buffering === true) {
544545
// Flush any existing output
545546
if (ob_get_length() > 0) {

0 commit comments

Comments
 (0)