4

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

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

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

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."

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.

Nate Aune
  • 91
  • 1
  • 2
  • 5

2 Answers2

13

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

Documentation says

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:

This now should be done that way:

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

foo($foo);

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

function foo($var) {
...
}

foo(&$foo);   // <--- wrong
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
3

Remove the & sign from the &$count at the end of the line.

Please bear in mind, that this is a core hack in wordpress, and it will be lost on an update..

beerwin
  • 9,813
  • 6
  • 42
  • 57
  • Updating Wordpress will not change the `wp-config.php`. Is that what you meant? – Quentin Apr 08 '13 at 16:32
  • It's not the main `wp-config.php` file, it's `feed-wp-config.php`. Is that also skipped when updating? – beerwin Apr 09 '13 at 19:14
  • the file `feed-wp-config.php` is not part of Wordpress, it's a script that edits `wp-config.php` so it will not be lost. – Quentin Apr 10 '13 at 07:03