- Status
- Resolved
- Reported for
- Advanced Custom Fields Multilingual 2.1.1
- Resolved in
- Advanced Custom Fields Multilingual 2.1.2
- Related plugin/theme
- Advanced Custom Fields (ACF)
- Topic tags
- Compatibility
Overview of the issue
If you are using Advanced Custom Fields plugin, you may encounter a fatal error in environments using PHP 8 or warnings in PHP 7, when saving posts containing repeater fields and if the “ACFML Synchronise translations” feature is turned on.
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, WP_Post given in .../wp-content/plugins/acfml/classes/Helper/HashCalculator.php on line 65
Workaround
Please, make sure of having a full site backup of your site before proceeding.
Option 1
- Turn off the Keep repeater and flexible sub-fields in the same order as the default language option and update the post.
If that is not possible, then:
Option 2
- Open …/wp-content/plugins/acfml/classes/Helper/HashCalculator.php file.
- Look for line 25.
- Replace:
return self::hashArray( $value );
- With:
return self::hashArray( (array) $value );