Skip to content
Snippets Groups Projects
Commit a341a838 authored by Andrew Dolgov's avatar Andrew Dolgov
Browse files

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

parent 51d2deee
No related branches found
No related tags found
No related merge requests found
......@@ -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] = [];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment