Răsfoiți Sursa

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.
András Marczinkó 16 ore în urmă
părinte
comite
99ee090236

+ 2 - 1
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 : '';
 		}
 	}
 }

+ 4 - 0
app/views/extension/serve.phtml

@@ -0,0 +1,4 @@
+<?php
+declare(strict_types=1);
+/** @var FreshRSS_View $this */
+echo $this->content;