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

master
Andrew Dolgov 4 years ago
parent 51d2deeea9
commit a341a838b1

@ -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] = [];
}

Loading…
Cancel
Save