[Resolved] ACFML Uncaught TypeError: count() in HashCalculator L65
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing an Error 500 when saving any existing posts in WordPress after updating the ACFML plugin. The error is caused by a TypeError in the HashCalculator.php file. Solution: We recommend updating the ACFML plugin to the latest version, which at the time of the support was version 2.1.2. To update, navigate to Plugins > Add New > Commercial tab and then check for updates.
Please note that this solution might be outdated or not applicable to your case. If after following these steps 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 the problem continues, please do not hesitate to 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.
Hi,
since updating ACFML we're experiencing the following error when saving any of our existing posts in WP. This throws Error 500 and pages won't save. We're unable to make any changes now.
Error Details
=============
An error of type E_ERROR was caused in line 65 of the file
/public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php. Error message: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php:65
Stack trace:
#0 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(65): count()
#1 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(52): ACFML\Helper\HashCalculator::isArrayOfArrays()
#2 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(25): ACFML\Helper\HashCalculator::hashArray()
#3 [internal function]: ACFML\Helper\HashCalculator::calculate()
#4 /public_html/web/app/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Collection.php(603): array_map()
#5 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(86): WPML\Collect\Support\Collection->map()
#6 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(52): ACFML\Helper\HashCalculator::hashAssociativeArray()
#7 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(25): ACFML\Helper\HashCalculator::hashArray()
#8 [internal function]: ACFML\Helper\HashCalculator::calculate()
#9 /public_html/web/app/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Collection.php(603): array_map()
#10 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(74): WPML\Collect\Support\Collection->map()
#11 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(52): ACFML\Helper\HashCalculator::hashArrayOfArrays()
#12 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(25): ACFML\Helper\HashCalculator::hashArray()
#13 [internal function]: ACFML\Helper\HashCalculator::calculate()
#14 /public_html/web/app/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Collection.php(603): array_map()
#15 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(86): WPML\Collect\Support\Collection->map()
#16 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(52): ACFML\Helper\HashCalculator::hashAssociativeArray()
#17 /public_html/web/app/plugins/acfml/classes/Helper/HashCalculator.php(25): ACFML\Helper\HashCalculator::hashArray()
#18 /public_html/web/app/plugins/acfml/classes/class-wpml-acf-repeater-shuffle.php(283): ACFML\Helper\HashCalculator::calculate()
#19 /public_html/web/app/plugins/acfml/classes/class-wpml-acf-repeater-shuffle.php(80): WPML_ACF_Repeater_Shuffle->calculateHash()
#20 /public_html/web/wp/wp-includes/class-wp-hook.php(324): WPML_ACF_Repeater_Shuffle->store_state_before()
#21 /public_html/web/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#22 /public_html/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action()
#23 /public_html/web/app/plugins/advanced-custom-fields-pro/includes/acf-form-functions.php(143): do_action()
#24 /public_html/web/app/plugins/advanced-custom-fields-pro/includes/forms/form-post.php(318): acf_save_post()
#25 /public_html/web/wp/wp-includes/class-wp-hook.php(326): ACF_Form_Post->save_post()
#26 /public_html/web/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#27 /public_html/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action()
#28 /public_html/web/wp/wp-includes/post.php(4828): do_action()
#29 /public_html/web/wp/wp-includes/post.php(4930): wp_insert_post()
#30 /public_html/web/wp/wp-admin/includes/post.php(453): wp_update_post()
#31 /public_html/web/wp/wp-admin/post.php(227): edit_post()
#32 {main}
Note: please exclude some unnecessary folders like /wp-content/uploads/, /wp-content/cache/ ... to reduce the file size. Your next reply is set to private to share the info.
I'm sorry but that's not very helpful - I need Option 2 to work (or other alternative).
I don't want to "Keep repeater and flexible sub-fields in the same order as the default language", we sometimes change the order of these fields.