• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem while adding Custom Libraries to CI3

#7
(07-03-2015, 02:53 AM)Narf Wrote: Well, neither CI_Loader::library(), nor any method in its stack trace call the load_class() function. And also, line 192 in system/core/Common.php for CI3 is this:


Code:
is_loaded($class);

... which couldn't possibly trigger the error message that you originally reported.

So, you most certainly have made modifications to the system/ directory, even if you didn't put your custom libraries in there. And that doesn't exclude the possibility of you having a MY_Loader override or one of your custom libs calling load_class() itself.

i put some echo in the common.php to check the error and what's happening there, so line number might change, as at my side line 192 points to 
PHP Code:
$_classes[$class] = isset($param)

 ? new 
$name($param)
: new 
$name(); 

and the error is due to the
Code:
new $name()
part, because it is trying to initialize a class CI_Directoryinfo , while it's not present there, because the class name of the file included above is Directoryinfo only, and i didn't made any changes to core , i just downloaded the CI3 zip file and started adding my libraries and controllers from the previous application.

Also if you might have noticed the following part in the above function that i pasted from Common.php CI_ is being added to all class names whether it's in system or application directory
Code:
$name = 'CI_'.$class;
PHP Code:
if (file_exists($path.$directory.'/'.$class.'.php'))
            {
                
$name 'CI_'.$class;
                if (
class_exists($nameFALSE) === FALSE)
                {
                    require_once(
$path.$directory.'/'.$class.'.php');
                }

                break;
            } 

and that will make the variable $name to be having value "CI_libraryname" , so that at the initialization point it will always try to initiate the $name(), while that class doesn't exist, due to the addition of "CI_" in the class name
Reply


Messages In This Thread
RE: problem while adding Custom Libraries to CI3 - by newdev - 07-03-2015, 03:07 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.