Welcome Guest, Not a member yet? Register   Sign In
My problem with $this-load->whatever
#1

[eluser]marquex[/eluser]
Hi,
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):

Code:
// 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?            
            if (file_exists($subclass))
            {
                $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:

Code:
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


Messages In This Thread
My problem with $this-load->whatever - by El Forum - 01-24-2010, 06:22 AM
My problem with $this-load->whatever - by El Forum - 01-24-2010, 07:32 AM
My problem with $this-load->whatever - by El Forum - 01-24-2010, 12:03 PM
My problem with $this-load->whatever - by El Forum - 01-24-2010, 02:04 PM
My problem with $this-load->whatever - by El Forum - 01-24-2010, 03:07 PM
My problem with $this-load->whatever - by El Forum - 01-24-2010, 03:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB