Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #638 from DarkSide666/patch-10
Browse files Browse the repository at this point in the history
fix order and remove unnecessary sorting in addHook (4.3)
  • Loading branch information
Romans Malinovskis committed Feb 10, 2015
2 parents 0476bd6 + e8a9f09 commit 1ba1c9a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/AbstractObject.php
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1ba1c9a

Please sign in to comment.