14

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???

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
Kiran Vemula
  • 161
  • 1
  • 1
  • 5
  • You shouldn't change core files. What application code causes this error? Can you edit your question and post your app controller code that leads to error? – Tpojka Jun 11 '15 at 16:31
  • Possible duplicate of [Only variable references should be returned by reference - Codeigniter](http://stackoverflow.com/questions/28348879/only-variable-references-should-be-returned-by-reference-codeigniter) – MGP Oct 13 '16 at 17:52

4 Answers4

42

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.

Community
  • 1
  • 1
aiai
  • 1,129
  • 2
  • 11
  • 21
16

In Common.php Change this

return $_config[0] =& $config;

to this

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

Problem is with assigning and returning data.

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
2

If your code is still not working, then try this.

$_config[1]=& $config;
return $_config[0];
A J
  • 3,970
  • 14
  • 38
  • 53
  • This results in: "A PHP Error was encountered Severity: Notice Message: Undefined index: subclass_prefix Filename: core/CodeIgniter.php Line Number: 237" – Marcelo Agimóvel Feb 22 '18 at 19:05
0

Codeigniter itself fixed that error now.

You just update current updated version of Codeigniter in here.

It will solve your error.

Karthik SWOT
  • 1,129
  • 1
  • 11
  • 15