I’m also experiencing this problem, and its just not going away.
I’m loading the native sessiona in my application/library directory. This seems OK, until CI encounter another request to load(‘session’).
It seems that it’s loading the system/library/Session.php at that stage, which it should not be doing, since its’s being replaced by my application/library/Session.php
Look at the code from the loader class. It seems like the problem is around here.
$is_duplicate = FALSE;
for ($i = 1; $i < 3; $i++)
{
// $path = ($i % 2) ? APPPATH : BASEPATH;
$path = ($i == 1) ? APPPATH : BASEPATH;
$fp = $path.'libraries/'.$class.EXT;
// Does the file exist? No? Bummer...
if ( ! file_exists($fp))
{
continue;
}
// Safety: Was the class already loaded by a previous call?
if (in_array($fp, $this->_ci_classes))
{
$is_duplicate = TRUE;
continue;
}
include($fp);
$this->_ci_classes[] = $fp;
return $this->_ci_init_class($class, '', $params);
}
OK. Let’s look at a few scenarious.
Scenario 1: No application/library AND No system/library/
Action: Code loops to top in first continue (because of file_exists() faliure.
Everrythinh OK here.
Scenario 1: application/library AND system/library/ Our scenario
Action: First time in loop: Look for application/library/Session.php and loads that because of
the include($fp) and then returns.
At this stage, $fp, which is the FULL PATH is placed into the $this->ci_classes[] array.
The function is exited without problem
Next time it sees a load(session) call, the code segment is called again.
First time in loop: Look for application/library/ file and sees that it ($fp) is loaded
(that’s tha APPPATH stuff). Code loops to top in second continues (in_arrray().
Next cycle in loop (bacuse of continue). Want’s to check the BASEPATH stuff.
Gets to the file_exists: OK
Gets to thein_array: NOT OK
So what does it do. THAT’S RIGHT. IT LOADS BASEPATH library.
What do you think?
EDIT: My application is fairly complex is that there is some cross calling accross models/controllers.
I saolved this by removing all refrences to $this->load->library(). At least this helps in the maentime, although I still feel the above code shows a processing error.