<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...')
Welcome to the WPML support forum. I will do my best to help you resolve the issue.
I have reopened this ticket for easy follow-up, and it will help us to avoid discussing multiple things in a single ticket.
We had a detailed test on our local copy. This fatal error is not trigging after the following steps. So please try it after a full site backup {mandatory} and make sure the bug exists or not.
1) Upgrade to the latest version of WPML (4.7.2)
2) Upgrade to the latest version of plugins like Disable Gutenberg & Gravity Forms
3) Go to WPML>>Support page, click on the Troubleshooting link (blue link in the middle of the page)
4) On the Troubleshooting page, please click on the following options of the *Clean up* section. Wait for confirmation of processing after each one.
- Clear the cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Set language information
- Fix WPML tables collation
- Assign translation status to duplicated content
- Fix terms count
- Fix post type assignment
- Cleanup and optimize string tables
5) Clear all types of caches
--
Thanks!
Bigul
The topic ‘[Closed] PHP Fatal error: Uncaught Error: Call to a member function get_source_language_code() in’ is closed to new replies.