CodeIgniter Error: variable references

Kiran Vemula picture Kiran Vemula · Jun 11, 2015 · Viewed 58.4k times · Source

I've deployed my source code in XAMPP. I'm getting following errors.

Notice: Only variable references should be returned by reference in C:\xampp\htdocs\3c_app\public_html\system\core\Common.php on line 257
Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocs\3c_app\public_html\system\core\CodeIgniter.php on line 233.

My source files are:

Common.php

// Are any values being dynamically replaced?
    if (count($replace) > 0)
    {
        foreach ($replace as $key => $val)
        {
            if (isset($config[$key]))
            {
                $config[$key] = $val;
            }
        }
    }

    return $_config[0] =& $config;
}

line 257 is: return $_config[0] =& $config; and

Codeigniter.php

// Fetch the config file
    if ( ! file_exists($file_path))
    {
        exit('The configuration file does not exist.');
    }

    require($file_path);

line 233: if ( ! file_exists($file_path))

Can any one help???

Answer

aiai picture aiai · Jun 12, 2015

Try this one:

Change it in your Common.php

if (count($replace) > 0){
    foreach ($replace as $key => $val){
        if (isset($config[$key])){
            $config[$key] = $val;
        }
    }
}

$_config[0] =& $config;
return $_config[0];

See also here , for more reference : Only variable references should be returned by reference - Codeigniter . I hope this helps.