summaryrefslogtreecommitdiff
path: root/classes/pluginhost.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-11-14 16:49:10 +0300
committerAndrew Dolgov <[email protected]>2021-11-14 16:49:10 +0300
commitaf2f4460ce94f48aa4c3bb3176c59325b6612b32 (patch)
tree7d49a2d9ac31ec6493b60a2bb4a957d38164cc48 /classes/pluginhost.php
parentc3ffa08807df4a83cd476aca79fc96217acc6c3a (diff)
* deal with some phpstan warnings in base plugin class
* arguably better hack for incompatible plugins causing E_COMPILE_ERROR
Diffstat (limited to 'classes/pluginhost.php')
-rwxr-xr-xclasses/pluginhost.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 7688a6d0d..4b0c14a35 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -434,16 +434,24 @@ class PluginHost {
// WIP hack
// we can't catch incompatible method signatures via Throwable
- // maybe also auto-disable user plugin in this situation? idk -fox
- if ($_SESSION["plugin_blacklist.$class"] ?? false) {
- user_error("Plugin $class has caused a PHP Fatal Error so it won't be loaded again in this session.", E_USER_NOTICE);
+ // this also enables global tt-rss safe mode in case there are more plugins like this
+ if (($_SESSION["plugin_blacklist"][$class] ?? 0)) {
+
+ // only report once per-plugin per-session
+ if ($_SESSION["plugin_blacklist"][$class] < 2) {
+ user_error("Plugin $class has caused a PHP fatal error so it won't be loaded again in this session.", E_USER_WARNING);
+ $_SESSION["plugin_blacklist"][$class] = 2;
+ }
+
+ $_SESSION["safe_mode"] = 1;
+
continue;
}
try {
- $_SESSION["plugin_blacklist.$class"] = true;
+ $_SESSION["plugin_blacklist"][$class] = 1;
require_once $file;
- $_SESSION["plugin_blacklist.$class"] = false;
+ unset($_SESSION["plugin_blacklist"][$class]);
} catch (Error $err) {
user_error($err, E_USER_WARNING);