Message: Only variable references should be returned by reference In Codeigniter
core/Common.php
Last line is causing the issue. return $_config[0] =& $config;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
f (!function_exists('get_config')) { function & get; _config($replace = array()) { static $_config; if (isset($_config)) { return $_config[0]; } // Is the config file in the environment folder? if (!defined('ENVIRONMENT') OR!file_exists($file_path = APPPATH. 'config/'.ENVIRONMENT. '/config.php')) { $file_path = APPPATH. 'config/config.php'; } // Fetch the config file if (!file_exists($file_path)) { exit('The configuration file does not exist.'); } require($file_path); // Does the $config array exist in the file? if (!isset($config) OR!is_array($config)) { exit('Your config file does not appear to be formatted correctly.'); } // 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; } } |
Solution
Here is the github reference link which mention the above issue. To fix this you have use latest version of codeigniter CI3.0 or you have to manually fix this issue. Just replace below code with return statement. It will solve the issue.
$_config[0] =& $config; return $_config[0];