Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -
- 20:00 – 23:00 20:00 – 23:00 20:00 – 23:00 20:00 – 23:00 20:00 – 23:00 -

Supporter timezone: Asia/Singapore (GMT+08:00)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Kor 1 year, 11 months ago.

Assisted by: Kor.

Author Posts
June 4, 2024 at 6:46 pm

Roxanne Rollin

Background of the issue:
We are getting an error on our website coming from the WPML plugin. I was attempting to perform some actions related to post translations. Here is the stack trace:

[04-Jun-2024 14:08:18 UTC] PHP Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, bool given in /wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php:319
Stack trace:
#0 /wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php(319): array_filter(false)
#1 /wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php(88): WPML_Element_Translation_Package->add_custom_field_contents(Array, NULL, Array, Array)
#2 /wp-content/plugins/sitepress-multilingual-cms/inc/actions/wpml-tm-action-helper.class.php(13): WPML_Element_Translation_Package->create_translation_package(NULL)
#3 /wp-content/plugins/sitepress-multilingual-cms/inc/actions/wpml-tm-post-actions.class.php(72): WPML_TM_Action_Helper->create_translation_package('125513')
#4 /wp-content/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php(947): WPML_TM_Post_Actions->save_post_actions(125514, Object(WP_Post), false)
#5 /wp-includes/class-wp-hook.php(324): wpml_tm_save_post(125514, Object(WP_Post), false)
#6 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#7 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 /wp-content/plugins/sitepress-multilingual-cms/inc/post-translation/wpml-post-translation.class.php(213): do_action('wpml_tm_save_po...', 125514, Object(WP_Post), false)
#9 /wp-content/plugins/sitepress-multilingual-cms/inc/post-translation/wpml-frontend-post-actions.class.php(61): WPML_Post_Translation->after_save_post('752903', Array, 'fr', NULL)
#10 /wp-includes/class-wp-hook.php(326): WPML_Frontend_Post_Actions->save_post_actions(125514, Object(WP_Post))
#11 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#12 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#13 /wp-includes/post.php(4828): do_action('save_post', 125514, Object(WP_Post), true)
#14 /wp-includes/post.php(4930): wp_insert_post(Array, false, true)
#15 /wp-content/themes/child/promotions.php(292): wp_update_post(Array)
#16 /wp-content/themes/child/promotions.php(184): Quad_Promotions->end_promotion('125514')
#17 /wp-content/themes/child/promotions.php(37): Quad_Promotions->process_promotions()
#18 /wp-content/themes/child/promotions.php(397): Quad_Promotions->__construct()
#19 /wp-includes/class-wp-hook.php(324): qe_promotion_load('')
#20 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#21 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#22 /wp-settings.php(695): do_action('init')
#23 /wp-config.php(99): require_once('/home/quadexper...')
#24 /wp-load.php(50): require_once('/home/quadexper...')
#25 /wp-blog-header.php(13): require_once('/home/quadexper...')
#26 /index.php(17): require('/home/quadexper...')
#27 {main}
thrown in /wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php on line 319

Symptoms:
PHP Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, bool given in /wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php:319. We also found these 3 other posts detailing the same error in the same file and line, but there were no provided solutions (at least nothing publicly posted):
https://wpml.org/forums/topic/error-when-we-want-to-translate-a-post/
https://wpml.org/forums/topic/i-get-error-500-when-saving-page/
https://wpml.org/forums/topic/we-are-using-wpml-together-with-wp-all-import-and-we-get-php-memory-errors/

Questions:
What is causing the PHP Fatal error in the WPML plugin?
How can we resolve the TypeError in the WPML plugin?

June 4, 2024 at 7:34 pm #15704148

Kor

Thanks for your patience.

Here is the link hidden link to our sandbox site. Feel free to install the required theme to replicate the issue.

I've also installed the phpmyadmin plugin for you to import the posts into the database.

Please let me know how it goes.

June 5, 2024 at 1:35 am #15704629

Roxanne Rollin

We exported the troublesome listing via phpMyAdmin and it's postmeta then ran the importer on your sandbox website and it ran the promo check without any issues.

Is your copy of WPML is any different at all?

June 5, 2024 at 11:59 am #15706514

Kor

Thank you for responding.

I've installed the most recent WPML plugin version. The only distinction I noticed between both sites is the PHP version. You can compare them here: hidden link and hidden link

Could you attempt using a previous PHP version to see if it resolves the issue?

June 5, 2024 at 12:17 pm #15706602

Roxanne Rollin

Downgrading to PHP 8.1 fixes it, however PHP 8.1 is no longer actively supported, it's security fixes only.

Will this be fixed in the next version? When will PHP 8.2+ be supported?

June 5, 2024 at 6:06 pm #15708490

Roxanne Rollin

We installed the WP-phpMyAdmin plugin (same one that was pre-installed on the last demo environment) but the "Enter local phpMyAdmin" results in a 403 forbidden: hidden link
Can you fix this so we can import the post data of the troublesome post?

June 5, 2024 at 7:10 pm #15708600

Roxanne Rollin

This just times out for me, does it load for you?

The topic ‘[Closed] WPML fatal error’ is closed to new replies.