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.

Tagged: 

This topic contains 19 replies, has 3 voices.

Last updated by Andrey 1 year, 8 months ago.

Assisted by: Andrey.

Author Posts
October 31, 2023 at 2:59 pm #14701405

Andrey
WPML Supporter since 06/2013

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

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

I’m sorry that you ran into trouble with this. I keep you updated.

November 1, 2023 at 11:09 am #14706725

Alessandro Bottai

Hello, sorry to chime in, but this is a very long standing bug, it's been there for years and it has never been fixed.
The problem is on the line 259 of sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php
if $element_id is an array, than it can't be the key of another array. It can happen for various cases, that $element_id is an array, let's not get in to investigating to causes of this.

The solution is to simply replace the line 253
if ( ! $element_id && ! $trid ) {
with this:
if ( is_array($element_id) || (! $element_id && ! $trid) ) {

I would really appreciate, if you would include this in your upcoming releases, because as of php8, this is not a warning any more, but a fatal error, which breaks many websites. I keep patching this file on every wp installation I managed, but since it's generating a fatal error now, an accidental update can break the whole site.

Thanks, best regards
Jozsef Burgyan
oooh.events developer

November 1, 2023 at 12:14 pm #14707285

Andrey
WPML Supporter since 06/2013

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

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

Thank you for your feedback, Jozsef. It could be different issue, to ensure that your problem gets the attention it deserves, please open a new ticket detailing your issue.


@mikaelL-10, Could you please try the following workaround? Go to wp-content/plugins/sitepress-multilingual-cms/classes/ATE/Review/ReviewTranslation.php, right after this line 46

$postId = $args[2];

add the following

					     if ( is_object( $args[2] ) && get_class( $args[2] ) == "WP_Post" ) {
						     $postId = $args[2]->ID;
					     }

Let me know if this helps.

November 2, 2023 at 11:15 am #14715629

mikaelL-10

The suggested code change worked!!!
I guess this will be a part of the next update!?

November 2, 2023 at 2:24 pm #14717663

Andrey
WPML Supporter since 06/2013

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

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

I am glad to hear that it works now! I cannot say if it will be in the next release, but the solution should be included in future versions.