From af2f4460ce94f48aa4c3bb3176c59325b6612b32 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 14 Nov 2021 16:49:10 +0300 Subject: * deal with some phpstan warnings in base plugin class * arguably better hack for incompatible plugins causing E_COMPILE_ERROR --- classes/pluginhost.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'classes/pluginhost.php') 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); -- cgit v1.2.3