Skip to content

Loading…

fix calling of callable hooks #3065

Merged
merged 2 commits into from

2 participants

@dtmax

If callable hook is defined, we have such error:
"Fatal error: Cannot use object of type Closure as array in ...system\core\Hooks.php on line 130"
because, if callable hook is function, [0] has no sense.

I propose in "call_hook" function just check, either hook is array, or not an array, and then pass data to "_run_hook", which do all other necesssary checks and run hook.

@narfbg narfbg merged commit f8b6180 into bcit-ci:develop

1 check was pending

Details continuous-integration/travis-ci The Travis CI build is in progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 27, 2014
  1. fix callable hooks

    Max committed
  2. fix callable hooks

    Max committed
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1 system/core/Hooks.php
View
2 system/core/Hooks.php
@@ -127,7 +127,7 @@ public function call_hook($which = '')
return FALSE;
}
- if (isset($this->hooks[$which][0]) && is_array($this->hooks[$which][0]))
+ if (is_array($this->hooks[$which]))
{
foreach ($this->hooks[$which] as $val)
{
Something went wrong with that request. Please try again.