Strange case sensitive problem with autoload own libraries |
Try to load a library 'MY_Userbundle.php' with
the autoload config. The class name of 'MY_Userbundle.php' is 'class MY_Userbundle' . When i do this in my localhost with : Code: $autoload['libraries'] = array('my_userbundle'); everything is fine, but if i try this on my productionserver, i get this error: Unable to load the requested class: My_userbundle when i change on production server to : Code: $autoload['libraries'] = array('MY_Userbundle'); everything is also fine. Im working with the prefix 'MY_' and when i rename the MY_Userbundle.php into Bundle.php and also renam the class MY_Userbundle in class Bundle and than do this in config_autoload : Code: $autoload['libraries'] = array('userbundle'); everything is also fine. Why my local settings don't run on the production server? What is going on here?
The use of MY_ as a class prefix is specifically intended for extending native CodeIgniter libraries.
Eg. $this->load->library('banana') will look for application/libraries/Banana.php, application/libraries/MY_Banana.php and system/libraries/CI_Banana.php. If you ask for $this->load->('my_banana'), CI will look for application/libraries/My_banana.php, application/libraries/MY_My_banana.php and system/libraries/CI_My_banana.php. On Windows, 'MY_Banana' would match any case, eg My_bAnAnA.php, whereas on Linux, CI will look for My_banana.php, making something appear to work locally although it fails on a production server.
It was my mistake, to think that all chars are convert to lower case.
If i have a Class UserBundle, than i must take care of the 'B' in UserBundle and load it like this, when im on a unix-system : Code: $autoload['libraries'] = array('userBundle');
Please, read the documentation about libraries:
http://www.codeigniter.com/userguide3/ge...aries.html You will learn that the file must have a first capital letter, and that libraries are loaded with lower case only (in fact, the loading mechanism is case-insensitive, but the .php file name isn't!). |
Welcome Guest, Not a member yet? Register Sign In |