05-25-2016, 05:08 AM
I encounter it while using CI->loader->library(XXX) with a subclass.
I create a parent lib and a sub lib in different file.
It's OK when calling load->library('Sub_lib').
However, it will not load the Parent_lib when calling load->library('Parent_lib') somewhere after loading Sub_lib.
In my opinion, it's better to check a duplicate loading just in _ci_init_library mothed.
change to
I have tried to fix it also with unittest, but there is no issue accociated with it.(https://github.com/bcit-ci/CodeIgniter/c...e?expand=1)
Could it be assigned to me after it is confirmed to be a bug?
Forgive my poor English, maybe, Chinglish(Chinese English.)
I create a parent lib and a sub lib in different file.
PHP Code:
class Parent_lib {
public function test()
{
echo "Parent";
}
}
PHP Code:
include_once('XXX');
class Sub_lib extends Parent_Lib{
public function test()
{
echo "Sub";
}
}
It's OK when calling load->library('Sub_lib').
However, it will not load the Parent_lib when calling load->library('Parent_lib') somewhere after loading Sub_lib.
In my opinion, it's better to check a duplicate loading just in _ci_init_library mothed.
PHP Code:
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;
}
change to
PHP Code:
if (class_exists($class, FALSE))
{
//do not check at here in case of object Inheritance
return $this->_ci_init_library($class, '', $params, $object_name);
}
I have tried to fix it also with unittest, but there is no issue accociated with it.(https://github.com/bcit-ci/CodeIgniter/c...e?expand=1)
Could it be assigned to me after it is confirmed to be a bug?
Forgive my poor English, maybe, Chinglish(Chinese English.)