summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorChih-Hsuan Yen <[email protected]>2022-07-03 18:40:04 +0800
committerChih-Hsuan Yen <[email protected]>2022-07-16 22:50:16 +0800
commitf3aceb4648ad95d50ae55235e4654f3c2b2d538e (patch)
tree41f3b372a4b3449263cdd5c5d6d23461c609a6cc /classes
parentfdd1c43612011060b4b876db438eb7ec62dd077d (diff)
Fix an error when disabling all user plugins
If I enabled some user plugins via Preferences -> Plugins and then disabled all of them, an error occurred: Jul 16 22:34:20 php[100]: PHP Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /usr/share/webapps/tt-rss/classes/pref/prefs.php:1027 Jul 16 22:34:20 php[100]: Stack trace: Jul 16 22:34:20 php[100]: #0 /usr/share/webapps/tt-rss/classes/pref/prefs.php(1027): array_filter() Jul 16 22:34:20 php[100]: #1 /usr/share/webapps/tt-rss/backend.php(136): Pref_Prefs->setplugins() Jul 16 22:34:20 php[100]: #2 {main} Jul 16 22:34:20 php[100]: thrown in /usr/share/webapps/tt-rss/classes/pref/prefs.php on line 1027 Apparently the issue was elevated from a warning to an error in PHP 8.0 [1]. [1] https://php.watch/versions/8.0/internal-function-exceptions
Diffstat (limited to 'classes')
-rw-r--r--classes/pref/prefs.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index 8c044b49f..7acd06aa4 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -1024,7 +1024,7 @@ class Pref_Prefs extends Handler_Protected {
}
function setplugins(): void {
- $plugins = array_filter($_REQUEST["plugins"], 'clean') ?? [];
+ $plugins = array_filter($_REQUEST["plugins"] ?? [], 'clean');
set_pref(Prefs::_ENABLED_PLUGINS, implode(",", $plugins));
}