From 99ee09023682ee014e3846b759917c16528ff997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Marczink=C3=B3?= Date: Sun, 6 Sep 2026 21:32:48 +0200 Subject: [PATCH] Fix PHP Warning: Cannot modify header information headers already sent (#9267) Closes #9229 I restored my accidently deleted patches with @Inverle fixes. This fix is still works perfectly. Sorry. (https://github.com/FreshRSS/FreshRSS/pull/9230) How to test the feature manually: With this change: 1. Go to FreshRSS UserCSS extension config 2. Enable the UserCSS and set the CSS code in it. 3. Go to FreshRSS feeds page. 4. Hit the ctrl + F5 button and see no errors in the nginx log. --- app/Controllers/extensionController.php | 3 ++- app/views/extension/serve.phtml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index 599babf7c..547fe80bc 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -362,7 +362,8 @@ class FreshRSS_extension_Controller extends FreshRSS_ActionController { header("Content-Disposition: inline; filename='{$filename}'"); header('Referrer-Policy: same-origin'); if (file_exists(DATA_PATH . '/no-cache.txt') || !httpConditional($mtime, cacheSeconds: 604800, cachePrivacy: 2)) { - echo $extension->getFile($filename); + $contents = $extension->getFile($filename); + $this->view->content = is_string($contents) ? $contents : ''; } } } diff --git a/app/views/extension/serve.phtml b/app/views/extension/serve.phtml index e69de29bb..af0b21ea1 100644 --- a/app/views/extension/serve.phtml +++ b/app/views/extension/serve.phtml @@ -0,0 +1,4 @@ +content;