summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-02-04 10:21:00 +0100
committerAleksander Machniak <alec@alec.pl>2015-02-04 10:21:00 +0100
commit20740a9650b24711b22d2597c1cff4d69d574b84 (patch)
treeda70a16bc747e4b357fb293024110be67d2c043c /program
parentdba43e7c8b796b0d98bab671a36a9bf22f9c0a86 (diff)
Fix error in exec_hook() in case some hook handler was unregistered before
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_plugin_api.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php
index b3a32985c..23732efa3 100644
--- a/program/lib/Roundcube/rcube_plugin_api.php
+++ b/program/lib/Roundcube/rcube_plugin_api.php
@@ -374,9 +374,11 @@ class rcube_plugin_api
*/
public function unregister_hook($hook, $callback)
{
- $callback_id = array_search($callback, $this->handlers[$hook]);
+ $callback_id = array_search($callback, (array) $this->handlers[$hook]);
if ($callback_id !== false) {
- unset($this->handlers[$hook][$callback_id]);
+ // array_splice() removes the element and re-indexes keys
+ // that is required by the 'for' loop in exec_hook() below
+ array_splice($this->handlers[$hook], $callback_id, 1);
}
}