Skip to content

Commit aa758b0

Browse files
fix: flush only active buffers in response stream (#57952)
1 parent 109efba commit aa758b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Routing/ResponseFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function stream($callback, $status = 200, array $headers = [])
203203
return new StreamedResponse(function () use ($callback) {
204204
foreach ($callback() as $chunk) {
205205
echo $chunk;
206-
ob_flush();
206+
when(ob_get_level() > 0, fn () => ob_flush());
207207
flush();
208208
}
209209
}, $status, array_merge($headers, ['X-Accel-Buffering' => 'no']));

0 commit comments

Comments
 (0)