1

So I need to setup a client website locally for improvements. I'm trying to search and replace any instances of the live site's name/url and replace it with a development one.

When I run the command:

wp search-replace 'livesite.com' 'local.lvh.me' --all-tables --precise --verbose

I get the following error:

PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /path_to_project/wp-content/plugins/gravityforms/common.php on line 4181
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp:0
PHP   2. include() /usr/local/bin/wp:4
PHP   3. include() phar:///usr/local/bin/wp/php/boot-phar.php:11
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:27
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = [] }) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:74
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1158
PHP   8. require() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1237
PHP   9. include_once() /path_to_project/wp-settings.php:371
Error: There has been a critical error on your website.Learn more about debugging in WordPress. There has been a critical error on your website.

I get that as the error says, curly braces are deprecated and need to be replaces with square braces. If I go to the file specified and change them over the search and replace progresses until it runs into the issue again. Obviously manually changing every occurrence of this error isn't really an option however as it would take days.

Is there a fix to this that I haven't spotted?

Any help would be greatly appreciated as this has been on the desk for awhile!

2
  • You appear to be running WP CLI with PHP 8, but have a plugin (Gravity Forms) installed that does not support PHP 8. You will need to downgrade your active PHP version in the CLI environment, or deactivate that plugin before running this command. – Jacob Peattie Mar 14 at 14:41
  • Hi @JacobPeattie, I changed my PHP version from 8.0 to 7.2 using sudo update-alternatives --config php. The original error is now gone, however, now I can't connect to the database! I get the following error on the command line Error: Error establishing a database connection. The DB credentials are correct in the wp.config file. The DB_HOST is set to 127.0.0.1 – Neil Mar 15 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.