0

In Codeigniter controller I have this statement:

$txt = str_replace($t, $bracketted_var, $txt, &$count);

$count variable is passed by reference and I'm using it's changed value later in program.

Discovered that on new installation with PHP/5.3.3-7 calling that controller gives me in Firefox this response:

The connection to the server was reset while the page was loading

Without any log entry in Apache access log. In Error log I noticed two entries: [Mon Aug 26 12:12:28 2013] [notice] child pid 32048 exit signal Segmentation fault (11) [Mon Aug 26 12:12:28 2013] [notice] child pid 32082 exit signal Segmentation fault (11)

I tried a couple of other browsers and Androind and iPhone too without getting a web page content.

The statement wasn't in the function that was called. It looks like some kind of syntax error arise during parsing php file.

Searching for a solution I discovered that this str_replace statement doesn't give that error:

$txt = str_replace($t, $bracketted_var, $txt, $count);

I did temporarily make change so that other parts of controller are working. But I need to use a changed $count variable with a number of changes. Any suggestions?

Searching I didn't find anything usefull about such an error.

4

1 回答 1

0

不推荐使用通过引用传递调用时间(在 PHP > v5.3 中,它在 v5.4 中完全删除,此时它将引发致命错误)。您可以将其保留为现在,$count应该更新,因为它本身表示为引用str_replace

http://php.net/manual/en/function.str-replace.phphttp://php.net/manual/en/language.references.pass.php

于 2013-08-26T10:29:22.957 回答