Skip Navigation

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
- 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 -
- 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 -

Supporter timezone: Europe/Vienna (GMT+01:00)

This topic contains 5 replies, has 1 voice.

Last updated by Bigul 3 weeks, 1 day ago.

Assisted by: Bigul.

Author Posts
February 10, 2025 at 5:26 pm #16689065

berntE

<b>Background of the issue: </b>
We have a site that is configured to automatically translate all content using auto-translations. When inspecting the debug.log file, I can see that a fatal error occurs on the site from time to time. It happens maybe 20-50 times per day.

<b>Symptoms: </b>
PHP Fatal error: Uncaught Error: Call to a member function get_source_language_code() on bool in functions-load-tm.php.

Here is the full stack trace that I see in the log file:

[10-Feb-2025 13:41:15 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_source_language_code() on bool in (redacted)/wp-content/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php:501
Stack trace:
#0 (redacted)/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/Hooks/class-wpml-tm-ate-jobs-actions.php(153): wpml_tm_create_ATE_job_creation_model(6223, true)
#1 [internal function]: WPML_TM_ATE_Jobs_Actions->{closure}(6223, 0)
#2 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php(164): array_map(Object(Closure), Array, Array)
#3 [internal function]: WPMLFPFns::WPMLFP{closure}(Object(Closure), Array)
#4 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array)
#5 [internal function]: WPMLFPFns::WPMLFP{closure}(Object(Closure), Array)
#6 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Traits/Macroable.php(56): call_user_func_array(Object(Closure), Array)
#7 (redacted)/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/Hooks/class-wpml-tm-ate-jobs-actions.php(152): WPMLFPFns::__callStatic('map', Array)
#8 (redacted)/wp-includes/class-wp-hook.php(324): WPML_TM_ATE_Jobs_Actions->added_translation_jobs(Array, 3, Object(WPML_TM_Translation_Batch))
#9 (redacted)/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#10 (redacted)/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#11 (redacted)/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(1478): do_action('wpml_added_tran...', Array, 3, Object(WPML_TM_Translation_Batch))
#12 (redacted)/wp-content/plugins/sitepress-multilingual-cms/classes/automatic-translation/Actions.php(221): TranslationManagement->send_jobs(Object(WPML_TM_Translation_Batch), 'post', 3)
#13 (redacted)/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/TranslateEverything.php(97): WPMLTMAutomaticTranslationActionsActions->createNewTranslationJobs('en', Array)
#14 (redacted)/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/TranslateEverything.php(58): WPMLTMATETranslateEverything->translateEverything(Object(WPMLTMAutomaticTranslationActionsActions))
#15 [internal function]: WPMLTMATETranslateEverything->run(Object(WPMLCollectSupportCollection), Object(WPMLTMAutomaticTranslationActionsActions))
#16 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/auryn/lib/Executable.php(42): ReflectionMethod->invokeArgs(Object(WPMLTMATETranslateEverything), Array)
#17 [internal function]: WPMLAurynExecutable->__invoke(Object(WPMLCollectSupportCollection), Object(WPMLTMAutomaticTranslationActionsActions))
#18 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/auryn/lib/Injector.php(641): call_user_func_array(Array, Array)
#19 (redacted)/wp-content/plugins/sitepress-multilingual-cms/classes/container/class-wpml-container.php(110): WPMLAurynInjector->execute(Array, Array)
#20 [internal function]: WPMLContainerContainer::execute(Array, Array)
#21 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Array, Array)
#22 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Maybe.php(106): WPMLFP{closure}(Array)
#23 (redacted)/wp-content/plugins/sitepress-multilingual-cms/classes/ajax/Factory.php(38): WPMLFPJust->map(Object(Closure))
#24 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(207): WPMLAjaxFactory->WPMLAjax{closure}(Object(WPMLCollectSupportCollection))
#25 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(257): WPMLFPRight->map(Object(Closure))
#26 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Promise.php(24): WPMLFPRight->chain(Object(Closure))
#27 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Promise.php(30): WPMLFPPromise->resolve(Object(WPMLFPRight))
#28 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Promise.php(30): WPMLFPPromise->resolve(Object(WPMLFPRight))
#29 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Promise.php(30): WPMLFPPromise->resolve(Object(WPMLFPRight))
#30 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Promise.php(30): WPMLFPPromise->resolve(Object(WPMLFPRight))
#31 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Promise.php(30): WPMLFPPromise->resolve(Object(WPMLFPRight))
#32 (redacted)/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wp/classes/Hooks.php(50): WPMLFPPromise->resolve(Object(WPMLFPRight))
#33 (redacted)/wp-includes/class-wp-hook.php(324): WPMLLIBWPHooks::WPMLLIBWP{closure}('')
#34 (redacted)/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#35 (redacted)/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#36 (redacted)/wp-admin/admin-ajax.php(192): do_action('wp_ajax_wpml_ac...')

<b>Questions: </b>
I hope that your developers will spend some time fixing this issue by adding better error handling, even if they are not able to reproduce the issue on their end.

PS: WHY ARE YOU CHANGING MY ISSUE??? I had already provided a full description, only for your system to change my explanations and remove the stack trace, which leads to extra work when trying to provide you with details.

PPS: After registering this ticket, I have updated to the newest version of the WPML plugins. For some reason, they did not show up as available updates on the plugin page.

February 11, 2025 at 8:40 am #16690300

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Welcome to the WPML support forum. Before passing this thread to my colleague, I would like to share some suggestions and possible solutions for the issues you mentioned.

We had similar error reports in the past while having corruption in Database tables. So please make sure the database tables (especially WPML tables like _icl_translate_job, _icl_translation_batches, etc..) have the correct settings. Refer to the following tickets for more details.

https://wpml.org/forums/topic/php-fatal-error-uncaught-error-call-to-a-member-function-get_source_language_code-on-bool-in-2/#post-15427695

https://wpml.org/forums/topic/split-php-fatal-error-uncaught-error-call-to-a-member-function-get_source_language_code-on-bool-in/

Please note that may you have to visit Plugins>>Add New>>Commerical tab and click on the *Check for updates* button to get the WPML automatic upgrade links of the latest version. This step will help us refresh the installer caches.

--
Thanks!

Bigul

February 12, 2025 at 4:10 pm #16697792

berntE

Hi Bigul,

Thank you for the pointers to the similar error reports.

I have now performed the suggested actions in both issues.

Unfortunately, our issue persists after making these changes. So it doesn't seem to be a a corrupt database in our case.

Thanks

February 13, 2025 at 9:34 am #16700934

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the updates. This may be a compatibility issue. So to make sure if possible, please do the following steps.

a) Backup your site first[Mandatory]
b) Switch for a moment to a WordPress default theme like 2024 or 2025
c) Deactivate all the plugins that are not related to WPML
d) Then check whether the issue exists or not
e) If the issue is gone, activate the plugins as a group of three or four to find which one has an interaction issue
f) Switch back to the original theme of the site

If you have a staging/dev site (a clone copy of the live site), you can try these steps there. So we can troubleshoot the bug without affecting the live site.

--
Thanks!

Bigul

February 14, 2025 at 2:56 pm #16706936

berntE

Hi

Sorry, but it's not a realistic option for us to disable our plugins on our live site, only to wait for a sporadic error to happen.

Instead, I've spent some time looking into you code and trying to figure out why the problem happens.

The fatal error happens in the `functions-load-tm.php` file where the first lines look like this:

function wpml_tm_create_ATE_job_creation_model( $job_id, $applyTranslationMemoryForCompletedJobs = true ) {
$job_factory = wpml_tm_load_job_factory();
$translation_job = $job_factory->get_translation_job( $job_id, false, 0, true );

However, the get_translation_job() function can return `false` in certain circumstances.

I have analyzed the SQL that this function generates, and I can see that it returns no results if the `element_id` column in the `wp_icl_translations` table is NULL.

So the first point is still: It would be good if your developers could add appropriate error handling in this function in the cases where get_translation_job() returns false.

I've also looked into the different translations job IDs that fail to see if I could find a pattern.

And it turns out that these translations jobs are all related to element_type "post_acf-field-group". See the top half of the attached screenshot which shows my SQL query and the results. Notice in the screenshot how element_id is NULL for all these jobs.

However, when I check the translation settings in WPML, the "Field Group" post type is set to NOT be translatable (see the last half of the attached screenshot).

So there seems to be an additional problem: That these non-translatable post-types has been sent for translation.

I hope this is enough information for your team to look into these problems. Otherwise, let us know.

Thanks

wpml-problem.jpg
February 14, 2025 at 5:25 pm #16707626

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the details. This requires further checking. So a couple of requests for tracking this bug.

1) Please fill in the private details fields after a full site backup. I would like to access the admin area of your site for further checking. Refer to the following links for more details about our private information sharing policies.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

hidden link

2) Please allow us to make a duplicator copy of your site using the Duplicator plugin (https://wordpress.org/plugins/duplicator/) for debugging the issue on our local server.

--
Thanks!

Bigul

The topic ‘[Closed] PHP Fatal error: Uncaught Error: Call to a member function get_source_language_code() in functions-…’ is closed to new replies.