Resolved
Reported for: Advanced Custom Fields Multilingual 2.1.1
Resolved in: Advanced Custom Fields Multilingual 2.1.2
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 );
Both workarounds work for us. Is this going to be implemented as a bugfix release?
Sure, we are working in a next release!
We will keep his page updated.
Hello,
Unfortunately, option 1 doesn’t work for us as we need to keep fields order in sync as much as possible.
I tried Option 2, but that didn’t work either – I stopped getting script error, but instead started getting Segmentation faults errors on WPEngine.com hosting (I checked with WPEngine team, and they confirmed seg faults occurring).
Considering segmentation faults are not really meaningful, I didn’t ask for memory dumps etc – this all seems to be just a bug in the plugin (which never occurred before – as the page was build over a period of time without issues).
Could you have another look at the issue and check if there’s a better fix that doesn’t result in seg faults and/or errors.
Hey there,
Our dev team is working in a next release. However, if the workaround here provided doesn’t work for you, you can open a chat in our assistance channel for investigating it better.
Regards
Hey everyone,
We just released Advanced Custom Fields Multilingual 2.1.2 which should solve this issue.
Confirming version 2.1.2 fixes the issue.
Thanks for the quick fix guys!
Thank you for your confirmation! 🙂
I continue with the same problem and I cannot update anything in the text fields on the company page and I need to be able to do so.
If you are still seeing the same PHP error even after upgrading our ACFML plugin to 2.1.2, please open a chat in our assistance channel.
We have the require tools for investigating your case there.