Skip Navigation

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

Problem:
If you're experiencing an 'Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, float given' error in ACFML, it might be due to a Google Map field storing latitude and longitude as float values, which our hashing algorithm was not handling properly.

Solution:
We recommend you follow the errata we published for a simple fix. You can find the details and step-by-step instructions on how to apply the solution on your site at https://wpml.org/errata/advanced-custom-fields-php-fatal-error-uncaught-typeerror-count-argument-1-value-must-be-of-type-countablearray/.

If this solution does not resolve your issue or seems irrelevant 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 further assistance is needed, please open a new support ticket at WPML support forum.

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 6 replies, has 2 voices.

Last updated by Waqas Bin Hasan 12 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
May 28, 2024 at 12:23 pm

eikoT

Background of the issue:
ACFML; Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, float given

Symptoms:
ACFML; Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, float given

Questions:
Can you help me reopen my chat with Carlos or continue the support here?
What could be causing the 'Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, float given' error in ACFML?

May 28, 2024 at 12:40 pm
May 28, 2024 at 2:06 pm #15679047

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Reference to our recent chat, I've checked the issue in your site and was able to reproduce.

I then tried "Option 1" from this errata https://wpml.org/errata/advanced-custom-fields-fatal-error-uncaught-typeerror-count-argument-1-value-must-be-of-type-countablearray-wp_post-given/, which I believe you've already checked.

Option 1: Turn off the Keep repeater and flexible sub-fields in the same order as the default language option and update the post -> seems to work fine.

While Option 2 doesn't (throws 503 error as noted in other chat). The proposed change was supposed to be included in the latest version but not sure why it doesn't and runs into the said 503 error.

Anyways, I'm checking with the relevant team and 'll escalate the issue based on the information I receive.

I'll get back to you accordingly.

Regards.

May 29, 2024 at 7:52 am #15681955

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I am trying to reproduce the problem in a fresh sandbox site by:

- Copying your theme.
- Adding related configs from your wp-config.php file in sandbox's wp-config.php.
- Installing and setting up WPML, WPML ST, ACF and ACFML.
- Importing all posts, post types, taxonomies, ACF field groups and etc.

But surprisingly, even the post types have been created, and after importing posts, I am not seeing any of your theme defined post type having a place to (even) add a new post - see attached.

So can you please log into this sandbox (hidden link - one click login) and setup things accordingly? Then try to reproduce the problem please.

Also let me know any special steps needed to enable add new posts under those post types, as well as, importing existing posts from your site.

Screenshot 2024-05-29 125021.jpg
June 3, 2024 at 11:39 am #15697698

eikoT

Hi Waqas, ah I see, we did have custom user capabilities for those post types. I made some changes so it all works in this minimal configuration.

Importing all our posts did not work well though, I hit a timeout importing our +100mb export file.

I was able to reproduce the issue in post ID 205 (Listing)
hidden link

Just hit the [update] button and you should get the error like on our sites.

June 4, 2024 at 6:48 am #15699809

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates. I am looking into this and 'll get back to you after consulting with the team.

Please allow me some time.

June 5, 2024 at 7:18 am #15705289

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting on this. I've escalated the issue to 2nd tier team for further investigation.

I'll update you as things progress on our side.

June 5, 2024 at 12:51 pm #15706910

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Our team investigated the issue and found that the issue happens because there's a Google Map field, that stores the latitude and longitude as float values. Our hashing algorithm was not handling floats.

Team has published an errata with a simple fix, please see https://wpml.org/errata/advanced-custom-fields-php-fatal-error-uncaught-typeerror-count-argument-1-value-must-be-of-type-countablearray/ for details.

I've applied this in my sandbox site and seems to work just fine.

Please follow the errata, apply the solution in your site and let me know.

June 6, 2024 at 12:48 pm #15711064

eikoT

Thanks, that worked for me!

Hope with that you've now caught all possible data types in the hashing function.

Kind Regards,
Jann