From e7a15b880e2309d9c8e7c272ceca346a813aaa32 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 29 Jan 2025 11:26:43 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Handle=20th?= =?UTF-8?q?e=20response=20with=20the=20kernel=20before=20shutdown=20(#430)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Roots/Acorn/Application/Concerns/Bootable.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Roots/Acorn/Application/Concerns/Bootable.php b/src/Roots/Acorn/Application/Concerns/Bootable.php index 4aa01d7f..c5283673 100644 --- a/src/Roots/Acorn/Application/Concerns/Bootable.php +++ b/src/Roots/Acorn/Application/Concerns/Bootable.php @@ -223,22 +223,17 @@ protected function registerRequestHandler( ob_start(); remove_action('shutdown', 'wp_ob_end_flush_all', 1); - add_action('shutdown', fn () => $this->handleRequest($request), 100); - } - /** - * Handle the request. - */ - public function handleRequest(\Illuminate\Http\Request $request): void - { $kernel = $this->make(HttpKernelContract::class); $response = $kernel->handle($request); - $response->send(); + add_action('shutdown', function () use ($kernel, $request, $response) { + $response->send(); - $kernel->terminate($request, $response); + $kernel->terminate($request, $response); - exit((int) $response->isServerError()); + exit((int) $response->isServerError()); + }, 100); } }