Skip to content

Commit 6e1a5ba

Browse files
authored
🩹 fix: Clean output buffering up to initial level (#480)
1 parent 4bb5cbc commit 6e1a5ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Roots/Acorn/Application/Concerns/Bootable.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function bootHttp(): void
123123
$kernel->bootstrap($request);
124124

125125
if ($this->app->handlesWordPressRequests()) {
126-
$this->registerWordPressRoute();
126+
$this->registerWordPressRoute(ob_get_level());
127127
}
128128

129129
try {
@@ -150,9 +150,9 @@ protected function enableHttpsInConsole(): void
150150
/**
151151
* Register a default route for WordPress requests.
152152
*/
153-
protected function registerWordPressRoute(): void
153+
protected function registerWordPressRoute(int $initialObLevel): void
154154
{
155-
Route::any('{any?}', fn () => tap(response(''), function (Response $response) {
155+
Route::any('{any?}', fn () => tap(response(''), function (Response $response) use ($initialObLevel) {
156156
foreach (headers_list() as $header) {
157157
[$header, $value] = preg_split("/:\s{0,1}/", $header, 2);
158158

@@ -169,7 +169,7 @@ protected function registerWordPressRoute(): void
169169

170170
$levels = ob_get_level();
171171

172-
for ($i = 0; $i < $levels; $i++) {
172+
for ($i = $initialObLevel; $i < $levels; $i++) {
173173
$content .= ob_get_clean();
174174
}
175175

0 commit comments

Comments
 (0)