From dd3709be29db9bf6ab82aa8088d45778bf10bc80 Mon Sep 17 00:00:00 2001 From: minimexat Date: Mon, 23 Feb 2026 01:36:32 +0100 Subject: [PATCH] fix: use ob_end_clean() instead of ob_end_flush() in readfileLowMemory() (#37298) * fix: use ob_end_clean() instead of ob_end_flush() in readfileLowMemory() (fixes #37239) * fix: use robust ob level cleanup loop per hregis review --------- Co-authored-by: f-hoedl Co-authored-by: Laurent Destailleur --- htdocs/core/lib/functions.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bba94b3f1bb..2dfa39b3165 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -15648,8 +15648,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) } // Be sure we don't have output buffering enabled to have readfile working correctly - while (ob_get_level()) { - ob_end_flush(); + $level = ob_get_level(); + ob_start(); + while (ob_get_level() > $level) { + ob_end_clean(); } // Solution 0