pluginhost: add a hack to not crash on an incompatible plugin more than once (per login) - UGLY

This commit is contained in:
Andrew Dolgov 2021-11-14 11:50:55 +03:00
parent 0a2dcacbcf
commit 15af164f69
1 changed files with 12 additions and 0 deletions

View File

@ -431,8 +431,20 @@ class PluginHost {
}
if (!isset($this->plugins[$class])) {
// 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);
continue;
}
try {
$_SESSION["plugin_blacklist.$class"] = true;
require_once $file;
$_SESSION["plugin_blacklist.$class"] = false;
} catch (Error $err) {
user_error($err, E_USER_WARNING);
continue;