I am developing my app on a windows system, and i made a personal library for user authentication in a file called trickyAuth.php
On windows everything is ok when loading it, but when i try the app on a linux system i get the error
Unable to load the requested class: trickyauth
I realized that the name of the library in the error message is in lower letters, so i had a look at the loader library and i see the next code in the _ci_load_class method (CI 1.7.2, Loader.php:751):
// We'll test for both lowercase and capitalized versions of the file name
foreach (array(ucfirst($class), strtolower($class)) as $class)
$subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.EXT;
// Is this a class extension request?
$baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT;
if ( ! file_exists($baseclass))
log_message('error', "Unable to load the requested class: ".$class);
show_error("Unable to load the requested class: ".$class);
So codeigniter try to load the files when their name is in lower letters or with the first letter capitalized, but never “as it is”. In windows it’s ok because there’s no difference between capital and lower letters, but on linux my code just doesn’t work.
I’m aware about the naming convention used by codeigniter, but it would be easy to check if the file is named exactly like the parameter:
foreach (array($class, ucfirst($class), strtolower($class)) as $class)
I’ll change my file name, but it’d be nice to add this to the next release of codeigniter