From e8a9f09a38c9cccf916400025793f6e51ac052d5 Mon Sep 17 00:00:00 2001 From: Imants Horsts Date: Mon, 9 Feb 2015 17:23:50 +0200 Subject: [PATCH] fix order and remove unnecessary sorting in addHook (4.3) --- lib/AbstractObject.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/AbstractObject.php b/lib/AbstractObject.php index d3f1e851e..a7c4b4646 100644 --- a/lib/AbstractObject.php +++ b/lib/AbstractObject.php @@ -765,7 +765,6 @@ function addHook($hook_spot, $callable, $arguments = array(), $priority = 5) } $this->hooks[$hook_spot][$priority][] = array($callable,$arguments); - ksort($this->hooks[$hook_spot]); return $this; } @@ -806,7 +805,7 @@ function hook($hook_spot, $arg = array ()) try { if (isset ($this->hooks[$hook_spot])) { if (is_array($this->hooks[$hook_spot])) { - ksort($this->hooks[$hook_spot]); // lower priority is called sooner + krsort($this->hooks[$hook_spot]); // lower priority is called sooner $hook_backup = $this->hooks[$hook_spot]; while ($_data = array_pop($this->hooks[$hook_spot])) { foreach ($_data as $prio => &$data) {