Aleksander Machniak
2015-02-04 20740a9650b24711b22d2597c1cff4d69d574b84
Fix error in exec_hook() in case some hook handler was unregistered before
1 files modified
6 ■■■■■ changed files
program/lib/Roundcube/rcube_plugin_api.php 6 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_plugin_api.php
@@ -374,9 +374,11 @@
     */
    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);
        }
    }