From be0280d02a408a8b4aeb6aee10d9dd936f978ce2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 28 Jun 2017 11:49:01 +0300 Subject: #5164 fix for stock libraries --- system/core/Loader.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'system/core') diff --git a/system/core/Loader.php b/system/core/Loader.php index cae01ed38..12922ca64 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1041,7 +1041,7 @@ class CI_Loader { if (class_exists($class, FALSE)) { $property = $object_name; - if ( ! isset($property)) + if (empty($property)) { $property = strtolower($class); isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$property]; @@ -1113,16 +1113,17 @@ class CI_Loader { $prefix = config_item('subclass_prefix'); } - // 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) + $property = $object_name; + if (empty($property)) { - $CI =& get_instance(); - if ( ! isset($CI->$object_name)) - { - return $this->_ci_init_library($library_name, $prefix, $params, $object_name); - } + $property = strtolower($library_name); + isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$property]; + } + + $CI =& get_instance(); + if ( ! isset($CI->$property)) + { + return $this->_ci_init_library($library_name, $prefix, $params, $object_name); } log_message('debug', $library_name.' class already loaded. Second attempt ignored.'); -- cgit v1.2.3-24-g4f1b