只有变量引用应该由引用- Codeigniter返回

时间:2022-10-06 09:06:06

After the server PHP upgrade I am getting the following error with PHP Version 5.6.2 on Apache 2.0

在服务器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

How can I fix this?

我该怎么解决这个问题呢?

4 个解决方案

#1


383  

Edit filename: core/Common.php, line number: 257

编辑文件名:核心/常见。php,行号:257

Before

之前

return $_config[0] =& $config; 

After

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

Update

Added by NikiC

添加NikiC

In PHP assignment expressions always return the assigned value. So $_config[0] =& $config returns $config - but not the variable itself, but a copy of its value. And returning a reference to a temporary value wouldn't be particularly useful (changing it wouldn't do anything).

在PHP赋值表达式中,总是返回赋值。所以$_config[0] =& $config返回$config -但不是变量本身,而是它的值的一个拷贝。返回一个临时值的引用不会特别有用(改变它不会做任何事情)。

Update

This fix has been merged into CI 2.2.1 (https://github.com/bcit-ci/CodeIgniter/commit/69b02d0f0bc46e914bed1604cfbd9bf74286b2e3). It's better to upgrade rather than modifying core framework files.

这个修复被合并到CI 2.2.1中(https://github.com/bcit-ci/CodeIgniter/commit/69b02d0f0bc46e914bed1604cfbd9bf74286b2e3)。最好升级而不是修改核心框架文件。

#2


8  

Change core/Common.php line number: 257 code with

改变核心/常见。php行号:257代码与

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

#3


7  

this has been modified in codeigniter 2.2.1...usually not best practice to modify core files, I would always check for updates and 2.2.1 came out in Jan 2015

这在codeigniter 2.2.1中被修改了……通常不是修改核心文件的最佳实践,我总是检查更新,2.2.1在2015年1月发布

#4


1  

It's not a better idea to override the core.common file of codeigniter. Because that's the more tested and system files....

重写codeigniter的core.common文件不是更好的主意。因为更多的测试和系统文件....

I make a solution for this problem. In your ckeditor_helper.php file line- 65

我对这个问题提出了一个解决方案。在你ckeditor_helper。php文件行- 65

if($k !== end (array_keys($data['config']))) {
       $return .= ",";
}

Change this to-->

改变这个- - >

 $segment = array_keys($data['config']);
    if($k !== end($segment)) {
           $return .= ",";
    }

I think this is the best solution and then your problem notice will dissappear.

我认为这是最好的解决办法,然后你的问题通知就会消失。

#1


383  

Edit filename: core/Common.php, line number: 257

编辑文件名:核心/常见。php,行号:257

Before

之前

return $_config[0] =& $config; 

After

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

Update

Added by NikiC

添加NikiC

In PHP assignment expressions always return the assigned value. So $_config[0] =& $config returns $config - but not the variable itself, but a copy of its value. And returning a reference to a temporary value wouldn't be particularly useful (changing it wouldn't do anything).

在PHP赋值表达式中,总是返回赋值。所以$_config[0] =& $config返回$config -但不是变量本身,而是它的值的一个拷贝。返回一个临时值的引用不会特别有用(改变它不会做任何事情)。

Update

This fix has been merged into CI 2.2.1 (https://github.com/bcit-ci/CodeIgniter/commit/69b02d0f0bc46e914bed1604cfbd9bf74286b2e3). It's better to upgrade rather than modifying core framework files.

这个修复被合并到CI 2.2.1中(https://github.com/bcit-ci/CodeIgniter/commit/69b02d0f0bc46e914bed1604cfbd9bf74286b2e3)。最好升级而不是修改核心框架文件。

#2


8  

Change core/Common.php line number: 257 code with

改变核心/常见。php行号:257代码与

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

#3


7  

this has been modified in codeigniter 2.2.1...usually not best practice to modify core files, I would always check for updates and 2.2.1 came out in Jan 2015

这在codeigniter 2.2.1中被修改了……通常不是修改核心文件的最佳实践,我总是检查更新,2.2.1在2015年1月发布

#4


1  

It's not a better idea to override the core.common file of codeigniter. Because that's the more tested and system files....

重写codeigniter的core.common文件不是更好的主意。因为更多的测试和系统文件....

I make a solution for this problem. In your ckeditor_helper.php file line- 65

我对这个问题提出了一个解决方案。在你ckeditor_helper。php文件行- 65

if($k !== end (array_keys($data['config']))) {
       $return .= ",";
}

Change this to-->

改变这个- - >

 $segment = array_keys($data['config']);
    if($k !== end($segment)) {
           $return .= ",";
    }

I think this is the best solution and then your problem notice will dissappear.

我认为这是最好的解决办法,然后你的问题通知就会消失。