CodeIgniter &get_instance() not working in php5.6 version?

Viewed 864

My codeigniter site is running properly in php5.4 version but when i upgrade my php version to php5.6.30 it is not working.

function &get_instance()
{       
    return CI_Controller::get_instance();
}

Above function is on 233 line of my file and it is returning null values.

Error - Fatal error: Class 'CI_Controller' not found in Coginiter_site\system\core\CodeIgniter.php on line 233

I have trace the error point - The code under system/core/common.php

if ( ! function_exists('load_class'))
{
    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 local application/libraries folder
        // then in the native system/libraries folder
        foreach (array(APPPATH, BASEPATH) as $path)
        {
            if (file_exists($path.$directory.'/'.$class.'.php'))
            {
                $name = $prefix.$class;

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

                break;
            }
        }

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

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

        // 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.'.php');
        }

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

        $_classes[$class] = new $name();
        return $_classes[$class];
    }
}

return empty result This line createing a problem $_classes[$class] = new $name(); Please check it.

2 Answers
Related