summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2017-06-27 15:31:17 +0200
committerAndrey Andreev <narf@devilix.net>2017-06-27 15:31:17 +0200
commit894a3f2c9fe111af35dee4f5e8e711259b893fb6 (patch)
tree77d201cb4f92101461167f82604a2c2aadc92711
parent763b7703ee744b65878bbf721fce3e5ec4dfac82 (diff)
Fix #5164
-rw-r--r--system/core/Loader.php41
-rw-r--r--user_guide_src/source/changelog.rst5
2 files changed, 26 insertions, 20 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 5ed6adb48..7be5fd41b 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -1037,6 +1037,26 @@ class CI_Loader {
return $this->_ci_load_stock_library($class, $subdir, $params, $object_name);
}
+ // Safety: Was the class already loaded by a previous call?
+ if (class_exists($class, FALSE))
+ {
+ $property = $object_name;
+ if ( ! isset($property))
+ {
+ $property = strtolower($class);
+ isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$object_name];
+ }
+
+ $CI =& get_instance();
+ if (isset($CI->$property))
+ {
+ log_message('debug', $class.' class already loaded. Second attempt ignored.');
+ return;
+ }
+
+ return $this->_ci_init_library($class, '', $params, $object_name);
+ }
+
// Let's search for the requested library file and load it.
foreach ($this->_ci_library_paths as $path)
{
@@ -1047,27 +1067,8 @@ class CI_Loader {
}
$filepath = $path.'libraries/'.$subdir.$class.'.php';
-
- // Safety: Was the class already loaded by a previous call?
- if (class_exists($class, FALSE))
- {
- // Before we deem this to be a duplicate request, let's see
- // if a custom object name is being supplied. If so, we'll
- // return a new instance of the object
- if ($object_name !== NULL)
- {
- $CI =& get_instance();
- if ( ! isset($CI->$object_name))
- {
- return $this->_ci_init_library($class, '', $params, $object_name);
- }
- }
-
- log_message('debug', $class.' class already loaded. Second attempt ignored.');
- return;
- }
// Does the file exist? No? Bummer...
- elseif ( ! file_exists($filepath))
+ if ( ! file_exists($filepath))
{
continue;
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 3012b9eb2..fd7485f64 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -8,6 +8,11 @@ Version 3.1.6
Release Date: Not Released
+Bug fixes for 3.1.6
+-------------------
+
+- Fixed a bug (#5164) - :doc:`Loader Library <libraries/loader>` method ``library()`` ignored requests to load libraries previously assigned to super-object properties named differently than the library name.
+
Version 3.1.5
=============