From a836c4a063e3671a8ac798115ef2fcf931edd2b0 Mon Sep 17 00:00:00 2001 From: Vladzimir <5346225+Vladzimir@users.noreply.github.com> Date: Fri, 23 Feb 2024 22:31:11 +0200 Subject: [PATCH 1/3] Fix buffering --- src/JsSse.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/JsSse.php b/src/JsSse.php index 8c92de6f7a..2ef331e043 100644 --- a/src/JsSse.php +++ b/src/JsSse.php @@ -190,8 +190,10 @@ protected function initSse(): void } // prevent buffering - if (ob_get_level()) { + $levels = ob_get_level(); + for ($i = 0; $i < $levels; $i++) { ob_end_flush(); } + flush(); } } From 8003fda754c99afcacea5168503b605977764ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 24 Feb 2024 01:52:37 +0100 Subject: [PATCH 2/3] simplify --- src/JsSse.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/JsSse.php b/src/JsSse.php index 2ef331e043..dcdb054a18 100644 --- a/src/JsSse.php +++ b/src/JsSse.php @@ -190,8 +190,7 @@ protected function initSse(): void } // prevent buffering - $levels = ob_get_level(); - for ($i = 0; $i < $levels; $i++) { + while (ob_get_level() > 0) { ob_end_flush(); } flush(); From a5e6b0d7e8b15a024029afca5cdf6631d63bc23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 22 Mar 2024 14:21:24 +0100 Subject: [PATCH 3/3] rm flush() preventing HTTP code to be set to 200 --- src/JsSse.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/JsSse.php b/src/JsSse.php index dcdb054a18..5b1b429346 100644 --- a/src/JsSse.php +++ b/src/JsSse.php @@ -193,6 +193,5 @@ protected function initSse(): void while (ob_get_level() > 0) { ob_end_flush(); } - flush(); } }