AdvancedCustomFields/acf

acf_site_health error where use wp-cli search-replace

Closed this issue · 1 comments

Describe the bug
When changing the website url through putty and wp-cli, it crashes with an error on the acf_site_health option

To Reproduce
Steps to reproduce the behavior:

  1. Go to putty
  2. Login site.com user
  3. print command
    wp search-replace 'en.site.com' 'site.com' --path='path/to/site.com'
  4. Press enter and see error
    PHP Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /var/www/site_user/data/www/www.site.com/wp-content/plugins/advanced-custom-fields-pro/includes/class-acf-site-health.php on line 23

in file it's this
public string $option_name = 'acf_site_health';
If I comment it out, then there are no more errors when executing the replacement

Screenshots or Video
error

Code

public string $option_name = 'acf_site_health';

Version Information:

  • WordPress Version 6.6.1
  • PHP Version PHP 8.3 as PHP-FPM
  • ACF PRO 6.3.5
  • putty & wp-cli

Hey there,

If you're receiving this error, it's because your CLI version of PHP is below 7.4. Your CLI version is different to the version used by the webserver in PHP-FPM.

Please contact your host for more help with this, as ACF requires PHP 7.4 or newer. Often host make specific versions of PHP available via different commands, such as php74 so you may need to swap to that for WP CLI - but your host will be able to advise better.