在服务器PHP升级后,我在Apache 2.0上使用PHP版本5.6.2时出现以下错误:
A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257
我该如何修复这个问题?
在服务器PHP升级后,我在Apache 2.0上使用PHP版本5.6.2时出现以下错误:
A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257
我该如何修复这个问题?
编辑文件名:core/Common.php,行号:257
之前的内容
return $_config[0] =& $config;
之后
$_config[0] =& $config;
return $_config[0];
由NikiC添加
在PHP中,赋值表达式总是返回被赋的值。因此,$_config[0] =& $config 返回的是$config的值的副本,而不是变量本身。返回指向临时值的引用并没有特别有用(改变它也不会有任何作用)。
此修复已合并到CI 2.2.1中(https://github.com/bcit-ci/CodeIgniter/commit/69b02d0f0bc46e914bed1604cfbd9bf74286b2e3)。最好升级而不是修改核心框架文件。
这在Codeigniter 2.2.1中已经被修改...通常不建议修改核心文件,我会始终检查更新,而2.2.1发布于2015年1月
覆盖codeigniter的core.common文件并不是一个更好的想法。因为那是经过更多测试和系统文件...
我为这个问题提供了一个解决方案。 在你的ckeditor_helper.php文件中 第65行
if($k !== end (array_keys($data['config']))) {
$return .= ",";
}
$segment = array_keys($data['config']);
if($k !== end($segment)) {
$return .= ",";
}
我认为这是最好的解决方案,然后您的问题通知将消失。
$_config[0] =& $config
返回$config
的值 - 但不是变量本身,而是其值的副本。返回对临时值的引用并没有特别有用(修改它不会产生任何效果)。 - NikiChttps://github.com/bcit-ci/CodeIgniter/commit/69b02d0f0bc46e914bed1604cfbd9bf74286b2e3
。像 @Chad 提到的那样升级是更好的选择。 - Syakur Rahman