summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/core/Loader.php40
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 9 insertions, 32 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php
index d2c350816..1111481b7 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -591,15 +591,21 @@ class CI_Loader {
*/
public function helper($helpers = array())
{
- foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper)
+ is_array($helpers) OR $helpers = array($helpers);
+ foreach ($helpers as &$helper)
{
+ $filename = basename($helper);
+ $filepath = ($filename === $helper) ? '' : substr($helper, 0, strlen($helper) - strlen($filename));
+ $filename = strtolower(preg_replace('#(_helper)?(.php)?$#i', '', $filename)).'_helper';
+ $helper = $filepath.$filename;
+
if (isset($this->_ci_helpers[$helper]))
{
continue;
}
// Is this a helper extension request?
- $ext_helper = config_item('subclass_prefix').$helper;
+ $ext_helper = config_item('subclass_prefix').$filename;
$ext_loaded = FALSE;
foreach ($this->_ci_helper_paths as $path)
{
@@ -1404,34 +1410,4 @@ class CI_Loader {
$CI =& get_instance();
return $CI->$component;
}
-
- // --------------------------------------------------------------------
-
- /**
- * Prep filename
- *
- * This function prepares filenames of various items to
- * make their loading more reliable.
- *
- * @param string|string[] $filename Filename(s)
- * @param string $extension Filename extension
- * @return array
- */
- protected function _ci_prep_filename($filename, $extension)
- {
- if ( ! is_array($filename))
- {
- return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension));
- }
- else
- {
- foreach ($filename as $key => $val)
- {
- $filename[$key] = strtolower(str_replace(array($extension, '.php'), '', $val).$extension);
- }
-
- return $filename;
- }
- }
-
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index e3183204c..ab2309608 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -15,6 +15,7 @@ Bug fixes for 3.1.3
- Fixed a regression (#4887) - :doc:`File Uploading Library <libraries/file_uploading>` triggered fatal errors due to numerous PHP distribution channels (XAMPP and cPanel confirmed) explicitly disabling ext/fileinfo by default.
- Fixed a bug (#4679) - :doc:`Input Library <libraries/input>` method ``ip_address()`` didn't properly resolve ``$config['proxy_ips']`` IPv6 addresses.
- Fixed a bug (#4902) - :doc:`Image Manipulation Library <libraries/image_lib>` processing via ImageMagick didn't work.
+- Fixed a bug (#4905) - :doc:`Loader Library <libraries/loader>` didn't take into account possible user-provided directory paths when loading helpers.
Version 3.1.2
=============