Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client encountered a fatal error when saving a page:

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /var/www/html/wp-content/plugins/acfml/classes/Helper/HashCalculator.php:65

.
Solution:
We recommended the client to follow the steps in the errata article after performing a full site backup. The article provides a workaround for the issue:
Advanced Custom Fields fatal error uncaught TypeError count() argument.

Additionally, we suggested disabling the 'Keep repeater and flexible sub-fields in the same order as the default language' option and then updating the post.

We also informed the client that a new version of ACFML (2.1.2) has been released, which includes a fix for this bug. We advised upgrading to the latest version after a full site backup:
ACFML Changelog.

If the solution provided here is not relevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket with us.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 12 replies, has 2 voices.

Last updated by Bigul 7 months, 1 week ago.

Assisted by: Bigul.

Author Posts
May 3, 2024 at 2:43 pm

johnS-9

I get the following error when saving the page

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /var/www/html/wp-content/plugins/acfml/classes/Helper/HashCalculator.php:65

May 3, 2024 at 4:40 pm
May 3, 2024 at 4:45 pm #15592317

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Please write back to us when the staging site is ready for testing after upgrading to the latest version of the WordPress, plugins, and theme. Take a full site backup{mandatory} before upgrading.

Also a couple of requests for tracking this bug.

1) Please let us know the exact steps to reproduce the issue on your site.

2) Please allow me to make a Duplicator copy of your site using the Duplicator plugin(https://wordpress.org/plugins/duplicator/) for debugging the issue on our local server in case of further debugging.

--
Thanks!

Bigul

May 3, 2024 at 4:49 pm #15592320

johnS-9

Hi there, I have now updated all plugins on the dev environment – please can you check this out? The issue happens when you try and re-publish or update the home page. Thanks

May 3, 2024 at 6:21 pm #15592596

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the updates. We will debug it further and get back to you as soon as possible. Please wait.

--
Thanks!

Bigul

May 7, 2024 at 7:26 am #15600114

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

We have released an errata for this bug. Please try the workaround suggested in the following article after a full site backup{mandatory} and make sure the issue exists or not.

https://wpml.org/errata/advanced-custom-fields-fatal-error-uncaught-typeerror-count-argument-1-value-must-be-of-type-countablearray-wp_post-given/

--
Thanks!

Bigul

May 7, 2024 at 8:37 am #15600410

johnS-9

Hi Bigul

I have tried replacing this line in the HashCalculator.php file, however I am still getting a 503 service unavailable error when I try and save this.

Please could you assist?

Thanks

May 7, 2024 at 9:43 am #15600801

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the updates. I have modified the code in the staging site. Refer to the attached image for more details. Please try it now and make sure the issue exists or not.

--
Thanks!

Bigul

2024-05-07_15-07-33.png
May 7, 2024 at 9:45 am #15600864

johnS-9

Hi Bigul, which image are you referring to sorry? I am attempting to save the home page on the staging site but I am getting a 502 error.

Thanks

May 7, 2024 at 9:47 am #15600887

johnS-9

Sorry I have just seen the screenshot. As mentioned above however, I still get a 502 error when saving the page.

May 7, 2024 at 10:21 am #15601091

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the updates. After disabling the following option and saving the Homepage, I am getting the expected results.


Turn off the Keep repeater and flexible sub-fields in the same order as the default language option and update the post

Please check it now and let us know your feedback. The fix for this bug will be included in upcoming version of ACFML.

--
Thanks!

Bigul

2024-05-07_15-50-57.png
May 7, 2024 at 1:35 pm #15602318

johnS-9

Hi Bigul,

This works when I uncheck the box, however in the scenario where this checkbox for the synchronisation translations needs to be checked, what would be the workaround for this?

Thanks

May 8, 2024 at 4:31 am #15604144

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the feedback. I am consulting with our team for an expert opinion on this. We will get back to you soon. Please wait.

--
Thanks!

Bigul

May 8, 2024 at 6:57 am #15604425

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

We have released a new version of ACFML(2.1.2). It has included the fix for this bug. Please upgrade to the latest version after a full site backup and make sure the issue exists or not.

https://wpml.org/download/acfml/?section=changelog

--
Thanks!

Bigul

May 9, 2024 at 10:00 am #15609827

johnS-9

Thanks Bigul, updating to v2.1.2 has resolved this issue!