1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 03:35:55 +00:00

* deal with some phpstan warnings in base plugin class

* arguably better hack for incompatible plugins causing E_COMPILE_ERROR
This commit is contained in:
Andrew Dolgov
2021-11-14 16:49:10 +03:00
parent c3ffa08807
commit af2f4460ce
3 changed files with 108 additions and 6 deletions

View File

@@ -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);