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

pluginhost: deny hook registration to plugins which lack relevant implementation methods

This commit is contained in:
Andrew Dolgov
2021-02-08 19:16:53 +03:00
parent 51d2deeea9
commit a341a838b1

View File

@@ -204,6 +204,15 @@ class PluginHost {
function add_hook($type, $sender, $priority = 50) {
$priority = (int) $priority;
if (!method_exists($sender, strtolower($type))) {
user_error(
sprintf("Plugin %s tried to register a hook without implementation: %s",
get_class($sender), $type),
E_USER_WARNING
);
return;
}
if (empty($this->hooks[$type])) {
$this->hooks[$type] = [];
}