“呼叫时间通过引用已被删除". [英] "Call-time pass-by-reference has been removed"

查看:141
本文介绍了“呼叫时间通过引用已被删除".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此存储库在Dotcloud上部署Wordpress,但是日志中出现错误:

I'm trying to deploy Wordpress on Dotcloud using this repo but there is an error that appears in the logs:

18:59:19: [www.0] Running postinstall script...
18:59:21: [www.0] PHP Fatal error:  Call-time pass-by-reference has been removed in /home/dotcloud/rsync-1353715101184/dotcloud-scripts/feed-wp-config.php on line 86

查看 feed-wp-config.php 中的第86行,其内容为:

Looking at line 86 in feed-wp-config.php, it reads:

$content = preg_replace('/(define\(\'' . $property . '\', \')(.*)(\'\);)/', '${1}' . $value . '${3}', $content, -1, &$count);

当我进入Wordpress起始页面时,它说:似乎没有wp-config.php文件.在开始之前,我需要此文件."

When I go to the Wordpress start page it says, "There doesn't seem to be a wp-config.php file. I need this before we can get started."

我已经将此交叉发布到了回购协议的Github问题跟踪器中,但由于尚未收到答复,我也将其张贴在这里,希望有人知道答案.

I've cross-posted this to the repo's Github issue tracker, but as there hasn't yet been a response I'm posting it here as well in hopes that someone knows the answer.

推荐答案

仅将&$count替换为$count. &表示您希望变量通过引用而不是值传递:

Replace &$count with just $count. & meant you want variable to be passed by reference, not value:

文档说

在函数调用上没有参考符号-仅在函数上 定义.仅函数定义就足以正确传递 通过引用的论点.从PHP 5.3.0开始,您将收到警告 说您使用&时不赞成使用通过引用传递时间" 在foo(& $ a);中.

There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);.

因此,如果要通过引用传递变量给函数,则应在函数声明中使用&:

So if you want to pass variable by reference to the function, you should use & in function declaration:

现在应该这样:

// right
function foo(&$var) {
...
}

foo($foo);

但不是那样(当您收到此警告时):

but not that way (as you get this warning):

function foo($var) {
...
}

foo(&$foo);   // <--- wrong

这篇关于“呼叫时间通过引用已被删除".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆