This thread is resolved. Here is a description of the problem and solution.
Problem: The client was experiencing 502 errors on their website, and the hosting company identified PHP fatal errors related to the WPML Media Translation plugin, specifically when handling thumbnail sizes. Solution: We asked the client if they could replicate the errors and suggested regenerating the thumbnails as a potential solution. We recommended using the Regenerate Thumbnails plugin. We also emphasized the importance of backing up the database before making any changes.
Please note that this solution might be irrelevant due to being outdated or not applicable to your case. If the issue persists, we encourage you to open 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.
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! We recently had some 502 errors and our hosting company noticed a number of PHP fatal errors in the logs and believe the contributed to the issue. Here is the full error:
PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /nas/content/live/ninjaone/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-image-translate.php:185\nStack trace:\n#0 /nas/content/live/ninjaone/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-image-translate.php(110): WPML_Media_Image_Translate->get_sized_image_url(202981, 'thumbnail', Array)\n#1 /nas/content/live/ninjaone/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-image-translate.php(131): WPML_Media_Image_Translate->get_translated_image(202981, 'nl', 'thumbnail')\n#2 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/media/class-wpml-page-builders-media-translate.php(45): WPML_Media_Image_Translate->get_translated_image_by_url('hidden link...', 'en', 'nl')\n#3 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/modules/abstract/class-wpml-elementor-media-node.php(59): WPML_Page_Builders_Media_Translate->translate_image_url('hidden link...', 'nl', 'en')\n#4 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/modules/abstract/class-wpml-elementor-media-node.php(22): WPML_Elementor_Media_Node->translate_image_array(Array, 'nl', 'en')\n#5 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/modules/class-wpml-elementor-media-node-image.php(13): WPML_Elementor_Media_Node->translate_image_property(Array, 'image', 'nl', 'en')\n#6 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/class-wpml-elementor-media-nodes-iterator.php(65): WPML_Elementor_Media_Node_Image->translate(Array, 'nl', 'en')\n#7 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/class-wpml-elementor-media-nodes-iterator.php(24): WPML_Elementor_Media_Nodes_Iterator->translate_node(Array, 'nl', 'en')\n#8 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/class-wpml-elementor-media-nodes-iterator.php(22): WPML_Elementor_Media_Nodes_Iterator->translate(Array, 'nl', 'en')\n#9 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/class-wpml-elementor-media-nodes-iterator.php(22): WPML_Elementor_Media_Nodes_Iterator->translate(Array, 'nl', 'en')\n#10 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/media/class-wpml-elementor-media-nodes-iterator.php(22): WPML_Elementor_Media_Nodes_Iterator->translate(Array, 'nl', 'en')\n#11 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/media/class-wpml-page-builders-update-media.php(49): WPML_Elementor_Media_Nodes_Iterator->translate(Array, 'nl', 'en')\n#12 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/class-wpml-pb-integration.php(441): WPML_Page_Builders_Update_Media->translate(Object(WP_Post))\n#13 /nas/content/live/ninjaone/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/Shutdown/Hooks.php(39): WPML_PB_Integration->translate_media(Object(WP_Post))\n#14 /nas/content/live/ninjaone/wp-includes/class-wp-hook.php(324): WPML\\PB\\Shutdown\\Hooks->translateMedias('')\n#15 /nas/content/live/ninjaone/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)\n#16 /nas/content/live/ninjaone/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#17 /nas/content/live/ninjaone/wp-includes/load.php(1260): do_action('shutdown')\n#18 [internal function]: shutdown_action_hook()\n#19 {main}\n thrown in /nas/content/live/ninjaone/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-image-translate.php on line 185, referer: hidden link
Could you please check into this and resolve this error. Thank you!
Are you able to replicate these errors on your website?
I have observed that the errors are associated with thumbnail sizes. Would you kindly attempt to regenerate the thumbnails to see if it resolves the problem? For instance, you can use this plugin: https://wordpress.org/plugins/regenerate-thumbnails/.
Before proceeding with any changes, please make sure to back up your database first.