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
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 6 replies, has 3 voices.

Last updated by Long Nguyen 1 year, 10 months ago.

Assisted by: Long Nguyen.

Author Posts
March 20, 2023 at 1:45 pm #13284933

gaborN-2

I have a LOCAL site, which I want to migrate from polylang to WPML. I tried to follow this article: https://wpml.org/documentation/related-projects/migrate-polylang-wpml/

After I open the migration tool, and click on the Migrate button, I see this:

Migration started, please don't close this window...
Moving your language settings...
Language settings has been migrated
Setting languages for posts...

And this is where it gets stuck

[20-Mar-2023 13:50:51 UTC] PHP Warning: Uninitialized string offset 0 in /wp-content/plugins/migrate-polylang-to-wpml-0.4/classes/class-mpw_migrate_posts.php on line 89

March 20, 2023 at 3:03 pm #13285567

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

I opened a private reply for the Duplicator link.

Regards,
Bruno Kos

March 21, 2023 at 8:02 am #13290559

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Gabor,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

I've requested access to the backup file in the Google Drive link. Please approve the request then I can download the backup file.
I also deleted the part from the path in the first message.

Look forward to your reply.
Thanks

March 21, 2023 at 8:52 am #13290961

gaborN-2

Hi, I gave you access a couple minutes before you wrote here. I hope you got the notification about it.

March 22, 2023 at 5:03 am #13299799

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Thank you for your feedback.

I download the backup file, run the migration on my demo site and see the issue happens when using PHP 8.1. If I downgrade PHP to 7.4 and the migration process will work properly.

I'm asking my 2nd tier support about this issue and update you here when I have something to share.

Thanks.

March 22, 2023 at 9:35 am #13302523

gaborN-2

Hi,
I confirm, that moving back to php 7.4 did solve the issue, I was able to migrate. Please go ahead, and try to fix this issue with php 8+, but hopefully I don't need further help. Feel free, to post it here, when there is a php 8+ compatible solution available for anyone else running into the same issue.
Thank you!

March 22, 2023 at 9:47 am #13302781

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Thank you for your feedback.

I got a workaround to fix this issue when using PHP 8.1, please make sure you have applied the workaround as my colleague suggested here https://wpml.org/forums/topic/problem-with-migrate-from-polylang/#post-12255319

Then around line 24, right before the line

list($trid, $post_type) = $this->set_original_post_language_details($relation, $default_language_code);

add this code

if( !is_array( $relation ) ) {
    continue;
}

and around line 94 replace the code

$original_post_id = isset($relation['sync']) ? $relation['sync'][$default_language_code['polylang']] : $relation[$default_language_code['polylang']];

with this one

$original_post_id = (isset($relation['sync']) ? $relation['sync'][$default_language_code['polylang']] : isset($relation[$default_language_code['polylang']])) ? $relation[$default_language_code['polylang']] : reset($relation);

❌ IMPORTANT: Please backup your database and website before proceeding ❌

Look forward to your reply.
Thanks

The topic ‘[Closed] migrate from polylang to WPML class-mpw_migrate_posts.php on line 89’ is closed to new replies.