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 4.04 hours from now. Thank you for your understanding.

This topic contains 26 replies, has 8 voices.

Last updated by capie 5 years, 10 months ago.

Assigned support staff: sarah.n.

Author Posts
October 3, 2013 at 6:03 am #271984

Richard

I got this in previous versions of WPML, and was hoping that this bug was fixed in the latest versions, but I'm still getting this stacktrace whenever I edit a published post that has a translation (2 in my case) attached to it.

My changes looked like they were saved, and I still see the 2 translations on my sites, so this looks like it's a non-destructive bug, so it may be a low priority.

Thanks,
Rich

Warning: Invalid argument supplied for foreach() in ....../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php on line 929

Warning: Invalid argument supplied for foreach() in....../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php on line 929

Warning: Cannot modify header information - headers already sent by (output started at ....../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php:929) in ....../wp-admin/post.php on line 222

Warning: Cannot modify header information - headers already sent by (output started at ....../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php:929) in ....../wp-includes/pluggable.php on line 875

October 3, 2013 at 6:40 am #271993

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+03:00)

Dear Richard,

Thank you for contacting to us !

Could you provide us screenshot WPML > Support, also what WordPress version you are using, theme name and link to website author ?

Thanks,
Andrey

October 18, 2013 at 6:59 am #278753

Richard

This issue is still happening for me, whenever I edit and already published article with translations.

Using WordPress 3.6.1

I am the author of the theme.

Thanks,
Rich

October 18, 2013 at 10:39 am #278880

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+03:00)

Dear Richard,

You need update your plugins to their latest versions :

WPML Multilingual CMS to version 2.9.3
WPML String Translation to version 1.9
WPML Translation Management to version 1.8

You can check the latest released versions under "My Account -> Downloads" on this site. Instructions to update can be found here: http://wpml.org/faq/install-wpml/#2

Please remember to backup your database first before you proceed! You can use a plugin for this if you like (search for WordPress backup plugins)

Let me know if the issue persists after the update has been done.

Thanks,
Andrey

October 18, 2013 at 4:08 pm #279110

Richard

I've updated all installed plugins and still get the crash when I edit a translated post.

Warning: Invalid argument supplied for foreach() in ..../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php on line 2023

Warning: Invalid argument supplied for foreach() in .../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php on line 2023

Warning: Cannot modify header information - headers already sent by (output started at .../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php:2023) in .../wp-admin/post.php on line 222

Warning: Cannot modify header information - headers already sent by (output started at .../wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php:2023) in .../wp-includes/pluggable.php on line 875

October 18, 2013 at 4:10 pm #279112

Richard

I uploaded my versions image with the same name as my old jpg, and it looks like your system is showing the old jpg (maybe my browser has cached it), so here it is again with an updated name.

October 18, 2013 at 8:25 pm #279233

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+03:00)

Dear Richard,

Very strange "Warning", can you please try switch theme to default (Twenty Thirteen) and test, still you have this issue?

Thanks,
Andrey

October 18, 2013 at 10:03 pm #279267

Richard

I switched to Twenty Thirteen temporarily on my live site and edited a post that has a translation, and got the same exact error.

Rich

October 21, 2013 at 8:24 am #279754

Amit
Supporter

Hi Rich,

This is Amit here, I am stepping in here, hope we can figure out where is this coming from.

Please provide me with the credentials to your website in the details box, and I'll take a look briefly.

Thanks!

October 21, 2013 at 3:57 pm #280127

Richard

Please tell me what you need from my site and I will provide it to you. I do not want to give out access to my live site. Sorry. I should be able to provide what you need.

Thanks,
Rich

October 21, 2013 at 4:17 pm #280137

Richard

FYI,

There seem to be other reports of this issue.

http://wpml.org/forums/topic/invalid-argument-supplied-for-foreach-2/

The report above explains the issue as some user permission problem. For the record, when I am editing the post, I am the Administrator of the site...

It seems another developer fixed this by modifying plugin code as explained in the next report.

http://wpml.org/forums/topic/error-invalid-argument-supplied-for-foreach/page/2/

Other reports:

http://wpml.org/forums/topic/invalid-argument-supplied-for-foreach-3/

http://wpml.org/forums/topic/invalid-argument-supplied-for-foreach-when-saving-page/

The issue above was opened January 2013 by someone else. I even commented on this one and uploaded info that was asked for, but it seems it was closed with no resolution.

Thanks,
Rich

October 21, 2013 at 4:26 pm #280145

Richard

The scenario explained in the bug report

http://wpml.org/forums/topic/invalid-argument-supplied-for-foreach-2/

Exactly matches mine.

I am the Admin (user #1). I am editing an English post created by another user (user #2). It has translations (up to 2 translations, Chinese simplified and traditional) that were created by another user (user #3).

I am not trying to update the translations, just the original English post.

It seems, if I click "Minor Edit" before saving, then I avoid the crash, as WPML is not trying to update the translation records??? If I do not click "Minor Edit" before saving, I get the crash.

So in this case, it seems I should always be selecting "Minor Edit", which is what I am doing, but more importantly, I don't want the crash.

Thanks,
Rich

From:

http://wpml.org/forums/topic/invalid-argument-supplied-for-foreach-2/

The post in question: "Les Oupaloux, Cotignac" was created by user ID 11 (Nathalie Brenkman) She is a Super Admin.

Now you come as the Admin (user ID 1) to edit a document that was not created by you.

WordPress allows you to edit the document however WPML already created a translation record for this doc in the db listing user ID 11 as the manager and translator of it.

Upon saving WPML performs a few security checks prior to updating this document's db record.
One of these security checks is whether the current user is either the translator or manager for this particular doc. If the check fails then the document record in the WPML db tables will not be updated and the add_translation_job() function aborts.

This is the point where WPML should either allow you to save your edits or return you back to the post edit screen with an admin message saying "You can't edit this document. It's assigned to a different translator."

October 22, 2013 at 6:45 am #280305

Amit
Supporter

Hi Rich, good morning.

I am assigning your ticket to 2 level support team member.

Cheers!

October 22, 2013 at 12:14 pm #280563

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

Hello Richard,

This is Sarah here. Amit has forwarded your forum thread to me so I will do my best to assist you further.

The reason why this issue seems to come up again and again without a real solution is because we have not yet been able to find the cause of this.

I understand it is not possible to be given access to your live site however I still need to replicate the problem for further investigation.

Would you be willing to create and send me a copy (clone) of your site created using the Duplicator plugin?
If so here's the link to the plugin: http://wordpress.org/plugins/duplicator/

Once you have the package ready let me know and I will email you so you will have an email to reply to with the package attached.

Thank you!

October 23, 2013 at 4:43 pm #281357

Richard

Hi Sarah,

Duplicator will not work on my site as it is too large. I found this out when trying to use it with Andrea Sciamanna for a previous issue. Too many comment and translation records in the DB (87,000 and 808,000 respectively).

I believe in a previous issue you yourself outlined the crashing scenario:

http://wpml.org/forums/topic/invalid-argument-supplied-for-foreach-2/

You all can not replicate it in house?

Thanks,
Rich

The topic ‘[Closed] WPML Crash when editing a published post that has translations’ is closed to new replies.