diff options
author | Andrey Andreev <narf@devilix.net> | 2014-01-07 17:08:26 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-01-07 17:08:26 +0100 |
commit | da8c7a5bb92b928c19918632d8cb8a06d0ea747d (patch) | |
tree | 61f89dd35e027b8f3619713e802d4fe78fd538cb | |
parent | d98c4a3557aa87c02f262f0f7495691f1bc174f0 (diff) |
Fix a few bugs in CI_Hook (based on PR #2762)
-rw-r--r-- | system/core/Hooks.php | 12 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/system/core/Hooks.php b/system/core/Hooks.php index b3b111991..aa7ac1e5d 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -184,7 +184,7 @@ class CI_Hooks { $function = empty($data['function']) ? FALSE : $data['function']; $params = isset($data['params']) ? $data['params'] : ''; - if ($class === FALSE && $function === FALSE) + if (empty($function)) { return FALSE; } @@ -195,9 +195,11 @@ class CI_Hooks { // Call the requested class and/or function if ($class !== FALSE) { - if ( ! class_exists($class, FALSE)) + class_exists($class, FALSE) OR require_once($filepath); + + if ( ! class_exists($class, FALSE) OR ! method_exists($class, $function)) { - require($filepath); + return $this->_in_progress = FALSE; } $HOOK = new $class(); @@ -205,9 +207,11 @@ class CI_Hooks { } else { + function_exists($function) OR require_once($filepath); + if ( ! function_exists($function)) { - require($filepath); + return $this->_in_progress = FALSE; } $function($params); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index e285ab014..670e8d0e1 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -641,6 +641,7 @@ Bug fixes for 3.0 - Fixed a bug (#2237) - :doc:`Parser Library <libraries/parser>` failed if the same tag pair is used more than once within a template. - Fixed a bug (#2268) - :doc:`Security Library <libraries/security>` didn't properly match JavaScript events. - Fixed a bug (#2143) - :doc:`Form Validation Library <libraries/form_validation>` didn't check for rule groups named in a *controller/method* manner when trying to load from a config file. +- Fixed a bug (#2762) - :doc:`Hooks Class <general/hooks>` didn't properly check if the called class/function exists. Version 2.1.4 ============= |