Skip Navigation

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

Problem:
In WooCommerce Multilingual & Multicurrency version 5.3.5, there is an issue with

array_filter

being called with a value that could be a string or an array, as returned by

WCML_Editor_UI_Product_Job::get_custom_field_values()

. In PHP 8+, this results in a fatal error because

array_filter

expects an array, not a string.
Solution:
We recommend applying the workaround described on the errata page. Please visit the following link for detailed instructions: Advanced Custom Fields PHP Fatal Error.

If this solution does not apply to your situation, or if it's outdated, we suggest opening a new support ticket. We also 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. For further assistance, please contact us through the 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 1 reply, has 2 voices.

Last updated by Carlos Rojas 1 year, 1 month ago.

Assisted by: Carlos Rojas.

Author Posts
March 7, 2024 at 11:19 am #15383892

joniL

In plugin WooCommerce Multilingual & Multicurrency, version 5.3.5

array_filter is called at woocommerce-multilingual/inc/translation-editor/class-wcml-editor-ui-product-job.php:612 with a value that can be a string or an array (as returned by WCML_Editor_UI_Product_Job::get_custom_field_values()). In php 8+ though, array_filter throws an error when it is called with anything other than an array.

This results in the following error message:

Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in woocommerce-multilingual\inc\translation-editor\class-wcml-editor-ui-product-job.php:612

Before php 8 this function call just resulted in a warning, and the value that array_filter was called with transformed into a null.

Sorry, I do not have steps to reproduce the error, but you can see that one function can return a string and the next does not accept strings.

March 7, 2024 at 2:28 pm #15384905

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello,
Thank you for contacting us

Please apply the workaround described in this errata page: https://wpml.org/errata/advanced-custom-fields-php-fatal-error-uncaught-typeerror-array_filter-argument-1-array-must-be-of-type-array/ and let me know if the issue was solved.

Regards,
Carlos