Skip Navigation

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

Problem:
If you're experiencing a 'Uncaught TypeError' when saving a page in the original language with ACFML version 2.1.0 or above, and you have true/false fields or Google location fields on it, you're not alone.
Solution:
We recommend trying the following steps:
1. Turn off the option 'Keep repeater and flexible sub-fields in the same order as the default language' and update the post.
2. If the error persists, edit the

\plugins\acfml\classes\Helper\HashCalculator.php

file. On line 25, replace:

return self::hashArray( $value );

with:

return self::hashArray( (array) $value );

Please ensure you backup your database before making any changes. This should resolve the error.

Please note that this solution might be irrelevant due to being outdated or not applicable to your case. If the issue persists, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please don't hesitate to open a new support ticket in the WPML support forum.

0% of people find this useful.

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 15 replies, has 3 voices.

Last updated by Andrey 1 year, 2 months ago.

Assisted by: Andrey.

Author Posts
May 1, 2024 at 10:57 am #15583648

basF

When i'm saving a page in the original language i'm getting an error from Version 2.1.0 or above and having true/fale fields or Google location fields on it.

The error is 'Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /data/sites/web/gaatbijnaonline02nl/subsites/epona.gaatbijnaonline.nl/wp-content/plugins/acfml/classes/Helper/HashCalculator.php:65 Stack trace: #0' See also the screenshot.

When i downgrade to ACFML v 2.0.5 it works perfectly

Scherm­afbeelding 2024-05-01 om 12.54.09.png
May 1, 2024 at 9:04 pm #15584960

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

I'm sorry to hear that you encountered some trouble with this.

Unfortunately, I haven't been able to replicate the problem on my end.

Would you mind helping me out with this? I've included a link to the staging site in the following message so that you can activate and install anything you need if missing. Thank you!

May 2, 2024 at 11:50 am #15586902

basF

Hi Andrey,

I did the installation and added two pages.
Home and Home with check
For both pages i made a translation to dutch
On the page home i have a checkbox unchecked and i can add extra partials to that page. On the page 'Home with check' i have checked the checkbox and than i cant edit the page anymore. After deleting the dutch translation is possible to edit the page again.

May 4, 2024 at 7:58 am #15593178

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for your feedback.

I want to clarify: were you able to replicate what you reported initially?

Please upload screenshots of the steps described in the previous message to help me better understand the problem.

May 6, 2024 at 8:11 am #15595781

basF

Hi Andrey,

I was able to replicate the problem.

- Edit page 'Home with check'
- Add new line underneath 'Pageheader' -> 'Intro'
- Add some text in the fields
- Update the page
- Refresh the page
- The Intro blok is gone
- This has to do with the checked/true value within the 'Pageheader' and if there is a second language for this page

If you do exactly the same with the page 'Home' (the checkbox is false) it works fine

May 6, 2024 at 12:30 pm #15597294

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for your feedback.

Could you please try the following workaround on your site and let me know?

Turn off "Keep repeater and flexible sub-fields in the same order as the default language." and update the post. If this is not the option then edit \plugins\acfml\classes\Helper\HashCalculator.php line 25 replace

return self::hashArray( $value );

with

return self::hashArray( (array) $value );

Please backup your database before making any changes. This should resolve the error you reported.

May 6, 2024 at 12:42 pm #15597340

basF

Hi Andrey,

Turn off "Keep repeater and flexible sub-fields in the same order as the default language." does the trick and then i get no error. But i want to keep the same order for all languages.

So maybe you can take this to the develop team.

But for now can i set this option global? So i don't have to do this for all pages

May 6, 2024 at 12:46 pm #15597362

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

We have already reported it to our development team. If you do not want to turn it off, you can also apply the workaround by replacing the line of the code I shared above. This should do the trick as well.

May 6, 2024 at 12:50 pm #15597370

basF

Hi Andrey,

When i change the code in \plugins\acfml\classes\Helper\HashCalculator.php line 25 i get an internal server error

May 6, 2024 at 12:56 pm #15597406

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Can you share the error you get?

You can enable enable the debug.log. You can do this by adding a few lines to the site’s wp-config.php file. With the error log enabled, you will see what the actual problem is.

To enable it, open your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

define('WP_DEBUG', true);

In order to enable the error logging to a file on the server you need to add yet one more similar line:

define( 'WP_DEBUG_LOG', true );

In this case, the errors will be saved to a debug.log log file inside the /wp-content/directory.

https://wpml.org/documentation/support/debugging-wpml/

Let me know what you see after the debug mode has been enabled.

May 6, 2024 at 1:19 pm #15597560

basF

This is the error in the log

[Mon May 06 15:17:12.638795 2024] [error] [pid 92033] mod_proxy_fcgi.c(719): [client 77.174.110.211:0] AH01067: Failed to read FastCGI header
[Mon May 06 15:17:12.638819 2024] [error] [pid 92033] mod_proxy_fcgi.c(1030): (104)Connection reset by peer: [client 77.174.110.211:0] AH01075: Error dispatching request to :

May 6, 2024 at 1:34 pm #15597596

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

It seems unrelated to WPML. I suspect it should be a fatal error in the debug.log that stops the server and returns an internal server error.

May 6, 2024 at 2:06 pm #15597799

basF

Hi Andrey,

Oke thank you for your help. I will wait till a new version of acml is out. Do you know if this fix is in the next release?

I will keep the version on my website 2.05 for now

May 6, 2024 at 2:07 pm #15597801

danielH-88

I'm seeing the exact same error, caused by true/false fields. The solution posted by @Andrey to change the line 25 of HashCalculator.php causes a different line to fail, and doesn't seem like a solution. This is what worked instead:

Change line 17 of HashCalculator.php:

````
} elseif ( is_int( $value ) ) {
````

to this:

````
} elseif ( is_int( $value ) || is_bool( $value ) ) {
````

Tested on PHP 8.3 with WPML 4.6.10 and ACFML 2.1.1.

The HashCalculator was introduced in 2.1.0.

In the meantime I have downgraded ACFML back to 2.0.5, which doesn't have the HashCalculator and doesn't cause issues either.

Did the WPML team test true/false fields with ACFML? Because this case isn't handled in the if/else tree.

May 6, 2024 at 2:44 pm #15598108

basF

But the same problem is also with location field (lat, lon) So you solution maybe is the fix for true / false fields. I will try it tomorrow. Otherwise i hope acfml will come with a bugfix soon