• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class load failure?

#1
[eluser]Unknown[/eluser]
So I've built a site which is fully operational on localhost. After migrating it to a remote server which supports PHP 5. I'm getting an error I'm not able to fix.

Fatal error: Call to a member function on a non-object in /ci/system/core/Router.php on line 68

The error pops up in the system core. The lines in question are included below:

Code:
function _set_routing()
    {
        // Are query strings enabled in the config file?  Normally CI doesn't utilize query strings
        // since URI segments are more search-engine friendly, but they can optionally be used.
        // If this feature is enabled, we will gather the directory/class/method a little differently
        $segments = array();
        if ($this->config->item('enable_query_strings') === TRUE AND isset($_GET[$this->config->item('controller_trigger')]))
        {
...

The error occurs right in the if statement.
It seems $this->config has not been properly loaded by load_class() in Common.php. Here's the constructor for the Router class:

Code:
function __construct()
    {
        $this->config =& load_class('Config', 'core');
        $this->uri =& load_class('URI', 'core');
        log_message('debug', "Router Class Initialized");
    }

and here's the load_class function.

Code:
function &load;_class($class, $directory = 'libraries', $prefix = 'CI_')
    {
        static $_classes = array();

        // Does the class exist?  If so, we're done...
        if (isset($_classes[$class]))
        {
            return $_classes[$class];
        }

        $name = FALSE;

        // Look for the class first in the native system/libraries folder
        // thenin the local application/libraries folder
        foreach (array(BASEPATH, APPPATH) as $path)
        {
            if (file_exists($path.$directory.'/'.$class.EXT))
            {
                $name = $prefix.$class;

                if (class_exists($name) === FALSE)
                {
                    require($path.$directory.'/'.$class.EXT);
                }

                break;
            }
        }

        // Is the request a class extension?  If so we load it too
        if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT))
        {
            $name = config_item('subclass_prefix').$class;

            if (class_exists($name) === FALSE)
            {
                require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT);
            }
        }

        // Did we find the class?
        if ($name === FALSE)
        {
            // Note: We use exit() rather then show_error() in order to avoid a
            // self-referencing loop with the Excptions class
            exit('Unable to locate the specified class: '.$class.EXT);
        }

        // Keep track of what we just loaded
        is_loaded($class);

        $_classes[$class] = new $name();
        return $_classes[$class];
    }
(Not sure what that semi-colon in the function name is doing there. It's not in my CI code)


It has always loaded before and I've made no changes to my system folder. All of my config variables should also be set correctly. I'm using CI version 2.02.

Is this a problem resulting from the migration to a new server?

Thanks in advance.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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