小编典典

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

all

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

我怎样才能解决这个问题?


阅读 48

收藏
2022-08-08

共1个答案

小编典典

编辑文件名: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
)。最好升级而不是修改核心框架文件。

2022-08-08