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.

Our next available supporter will start replying to tickets in about 1.50 hours from now. Thank you for your understanding.

This topic contains 14 replies, has 2 voices.

Last updated by Dennis 2 months, 3 weeks ago.

Assigned support staff: Dennis.

Author Posts
July 11, 2019 at 10:18 pm #4193285

jacquesL-8

I am trying to: Save a page in the main language (which already have some translations in some of the languages of the site). This happens for a lot of different pages.

Link to a page where the issue can be seen: NA

I expected to see: Be able to save the page without fatal error

Instead, I got: Fatal error: Uncaught TypeError: Argument 1 passed to WPML_TM_Unsent_Jobs::prepare_unsent_job_for_notice() must be an instance of WPML_Translation_Job

This is happening since an update that we made from 3.9.3 to 4.2.7.1 (to name only the core plugin)
We have debugged the problem quite a bit and we are trying to understand what goes wrong in the callstack. You probably have a better idea of what's not going as expected.

What we see in the given callstack, which happens right before the actual fatal error, is that
1- We are saving the page in the original language
2- during 1-, wpml try to save duplicates (it crashes on the first call to save_duplicate)
3- During the save_post_actions of the (first) duplicate, the update_translation_status call returns $update = false; because a new record is inserted in icl_translation_status; this causes add_translation_job to be called
4- fire_notification_actions calls get_translation_job with $as_job_instance = true
5- In get_translation_job, plain_objects_to_job_instances returns false for the given job because
5.1 is_translatable_post_type returns false
5.1.1 get_post_type returns false
5.1.1.1 get_original_document returns false
5.1.1.1.1 get_original_document_id returns false
5.1.1.1.1.1 get_iclt_field('element_id', false) returns false. Because of the AND i.source_language_code = o.language_code sql query condition, this function doesn't seem to support being passed a job with a job_id corresponding to the original page
6. So the output of get_translation_job is empty and this ultimately causes the fatal error

So if we summarize some problems that we see:
- As soon as is_translatable_post_type returns false for any reason, the crash will occur.
- get_iclt_field doesn't seem to support every case

We have also debugged the saving of the same page with the old wpml plugins to try to understand why we were able to save before and we have found that the callstack is not nearly as deep as the calls are being stopped in the WPML_Admin_Post_Actions::save_post_actions -> has_save_post_action(). In the new code, a new condition has been added that keeps the stack alive and then saves the duplicates (&& ! $http_referer->is_rest_request_called_from_post_edit_page())

We are looking for some advice on what we should expect to be called to help us with our investigation or obviously anything that could resolve our issues.

Thank you

WPML versions:
WPML Multilingual CMS Installed Yes 4.2.7.1
WPML CMS Nav Not installed No n/a
WPML String Translation Installed Yes 2.10.5.1
WPML Sticky Links Installed Yes 1.5.0
WPML Translation Management Installed Yes 2.8.6.2
WPML Media Installed Yes 2.5.2
WooCommerce Multilingual Not installed No n/a
Gravity Forms Multilingual Not installed No n/a
Yoast SEO Multilingual Not installed No n/a

July 12, 2019 at 7:10 am #4195715

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Welcome to WPML Support forum.

I would like to request temporary access (/wp-admin and FTP) to your site to take a better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. Your next reply will be set to private.

Maybe I'll need to replicate your site locally to continue debugging and escalate if necessary. For this I’ll need to temporarily install a plugin called “Duplicator” on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Please confirm if this okay with you.

Our Debugging Procedures
I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to BACKUP the site before providing us access.

Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Kind regards,
Dennis

July 12, 2019 at 2:08 pm #4199571

jacquesL-8

Hi Dennis,

I can't give you access to the site at this time and the client will most likely refuse to give access to 3rd parties. Is there any way we could do screen share with a local setup or this is out of the question? We also have a debugger ready to be used.

Maybe I could set you up a crashing case with all the db information like the wp_posts entries, wp_icl_translations entries, in a clean wordpress setup.

I will continue to try to find a solution to this, the only problem is I obviously don't want to break anything else by changing the wrong code and I don't exactly know what should normally be called etc.

As always, we should have resisted the temptation of updating the plugins...

Thanks again.

July 14, 2019 at 7:09 pm #4205923

jacquesL-8

Hi,

We managed to prepare a dev site that has the issue mentioned. Can we send you privately the info of this site so you can look at it?

Thanks

July 15, 2019 at 2:11 am #4206239

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your reply.

I have re-enabled the access information box so you could securely share the information with us.

Thanks.

Kind regards,
Dennis

July 15, 2019 at 10:08 am #4209583

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your reply. I will take a look and conduct some test and will try to debug your site. I will give you feedback as soon as I got some results.

Kind regards,
Dennis

July 16, 2019 at 4:02 am #4215893

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

I tried to re-send the the pages for translation in WPML > Translation Management and it resolves the issue. Could you please do the same on your site?

https://wpml.org/documentation/translating-your-contents/

Kind regards,
Dennis

July 16, 2019 at 4:59 pm #4222503

jacquesL-8

Hi,

Sending the pages to translation removes the fatal error, but we don't want to send them to translation (or there's something I don't understand). Once they are in the translation basket, we can't decide to translate for 1 language when we are editing a page. It changes the translation workflow. Unless there's something else we can do to have the same workflow and not remove from basket everytime we want to translate.

Thank you

July 17, 2019 at 7:07 am #4226305

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your reply.

After sending the page to translation, please try to delete the translation job from WPML > Translation Management > Translation jobs.

After that, try translating that page again without sending them to translation. Just use the Translation Editor from the post edit screen.

Does it help? Please let me know.

Kind regards,
Dennis

July 18, 2019 at 1:58 pm #4239453

jacquesL-8

Hi,

I don't see what I can do in the Translation Jobs tab. There's nothing to select. I must be missing something.

Thanks again

July 19, 2019 at 6:56 am #4244285

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

It could be that the page is not yet sent to translations. I can see that several pages are added to your Translation Basket. Could you please try to click the Translation Basket tab and click 'Clear Basket' button. As a test, we'll try to send one page first to translation. To do that,

-go to Translation Dashboard tab, select which page you want to send to translation.
-Select the necessary translation option and click 'Add selected content to translation basket'.
-click the Translation Basket tab. click 'Send all items for translation'
-you should now be able to see the status of the translation on the Translation Jobs tab.
-search for the page and click 'X' on the 'Actions' column.

Does it help? Please let me know.

Kind regards,
Dennis

July 19, 2019 at 5:45 pm #4247731

jacquesL-8

Hi,

It does seem to help. But now I need to do this for every pages, and I don't know how to select more than 10 translation jobs in the translation jobs tab. (There's around 900 job to cancel). Is there a way to cancel all jobs without cancelling in small batches of 10?

Thanks again.

July 22, 2019 at 6:22 am #4254195

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Unfortunately, WPML currently does not have that feature yet. Currently, jobs per page at Translation Jobs page is fixed to 10 jobs per page.

But that would be a good feature request. I would like to invite you send us your feature suggestions at:

https://wpml.org/suggest-a-new-feature-for-wpml/.

Thank you for the helping us to improve our product, have a nice day.

Kind regards,
Dennis

July 22, 2019 at 3:16 pm #4259253

jacquesL-8

Hi,

Ok thanks. Anyway this whole process is only a workaround over a bug in the software. I will have to make a fix locally on our code base to make it work asap.

Thanks.

July 23, 2019 at 8:49 am #4264095

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your reply.

Alright. I understand. Since you need the functionality as soon as possible I think it would be a better route.

Kind regards,
Dennis