[Resolved] Error on class wcml-synchronize-product-data array
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing a critical error when trying to connect WooCommerce to the Effitrace API, resulting in a 'Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given' error. This issue occurs in the WooCommerce Multilingual plugin. Solution: We recommend updating the WooCommerce Multilingual & Multicurrency plugin to the latest version, specifically version 5.5.1. This update addresses the error by removing the problematic line of code. After updating, please verify if the issue still persists. If it does, the error message will likely change, indicating a different line in the code, which can help us further diagnose the problem.
Please note that this solution might be outdated or not applicable to your specific 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 problem continues, 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.
Background of the issue:
I am trying to connect my WooCommerce to the Effitrace API, which is a REST API for stock and order management software. I expected the connection to work perfectly. Here's the more detailed code: Erreur: ERREUR CURL N° : 0 (), CODE ERREUR HTTP : [500] Erreur: REPONSE erreur 500 {"code":"internal_server_error","message":"<p>Il y a eu une erreur critique sur ce site.</p><p>hidden link">En apprendre plus sur le du00e9bogage de WordPress.</p>","data":{"status":500,"error":{"type":1,"message":"Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given in /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php:928nStack trace:n#0 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php(928): array_keys(false)n#1 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php(598): WCML_Synchronize_Product_Data::syncDeletedCustomFields(100193, NULL)n#2 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php(175): WCML_Synchronize_Product_Data->sync_downloadable_files(100193, NULL)n#3 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php(139): WCML_Synchronize_Product_Data->sync_product_data(100193, NULL, 'fr')n#4 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/classes/Rest/ProductSaveActions.php(49): WCML_Synchronize_Product_Data->synchronize_products(NULL, Object(WP_Post), true, Object(WP_REST_Request))n#5 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/classes/Rest/Wrapper/Products/Products.php(125): WCML\Rest\ProductSaveActions->run(Object(WC_Product_Simple), '1378', 'en', NULL, Object(WP_REST_Request))n#6 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/class-wp-hook.php(324): WCML\Rest\Wrapper\Products\Products->insert(Object(WC_Product_Simple), Object(WP_REST_Request), false)n#7 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)n#8 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/plugin.php(517): WP_Hook->do_action(Array)n#9 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php(268): do_action('woocommerce_res...', Object(WC_Product_Simple), Object(WP_REST_Request), false)n#10 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/rest-api/class-wp-rest-server.php(1292): WC_REST_CRUD_Controller->update_item(Object(WP_REST_Request))n#11 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wc/v2/products...', Array, NULL)n#12 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))n#13 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/rest-api.php(459): WP_REST_Server->serve_request('/wc/v2/products...')n#14 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP))n#15 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)n#16 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/plugin.php(565): WP_Hook->do_action(Array)n#17 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)n#18 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/class-wp.php(818): WP->parse_request('')n#19 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-includes/functions.php(1342): WP->main('')n#20 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-blog-header.php(16): wp()n#21 /home2/sc6zgnl2863/public_html/www.gaucherie.fr/index.php(17): require('/home2/sc6zgnl2...')n#22 {main}n thrown","file":"/home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php","line":928}},"additional_errors":[]}
Symptoms:
I encountered an error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given in /home2/sc6zgnl2863/public_html/www.gaucherie.fr/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php:928. I don't know why a boolean goes up instead of an array. I have no way of knowing on which product and which field the error occurs.
Questions:
Why is a boolean being passed instead of an array?
How can I identify the product and field where the error occurs?
Our second-tier supporter says that before we go any further with debugging this issue, you must update WooCommerce Multilingual & Multicurrency to its latest version 5.5.1. The line that the error points to no longer exists in the WooCommerce Multilingual & Multicurrency file. Please update and check if the problem persists. If it persists, then please share with us the new error, which will naturally be different, and point out another line in the file.