Problem/Motivation

In Drupal 7 metatag data is stored in LONGBLOB, but in Drupal 9 it is stored in LONGTEXT.
During migration d7_metatag_entities plugin unserialize data and save it in corresponding Drupal 8 tag name.
This drupal 7 data will throw exception if this has special characters (non Utf8 supporting Windows-1252 encoding).
Eg: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\\x92t be ...' for column `xxxx`.`node__field_metatag`.`field_metatag_value` at row 1: INSERT INTO "node__field_metatag"

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

narendraR created an issue. See original summary.

narendrar’s picture

Status: Active » Needs review
StatusFileSize
new877 bytes

Here is the initial patch.

damienmckenna’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks for providing a potential fix for this bug.

I think it would be useful to extend the existing tests to cover this - how about modifying the node fixtures to include some non-UTF8 characters?

wim leers’s picture

Title: Exception in migrating non Utf8 metatags » SQL error when migrating non-UTF8 metatags
Priority: Normal » Major
narendrar’s picture

Status: Needs work » Needs review
StatusFileSize
new1012 bytes
new2.04 KB

Added non-UTF8 character in user data to include test coverage.

damienmckenna’s picture

StatusFileSize
new1.13 KB

Thank you.

Let's see what happens when the tests are ran on their own.

Status: Needs review » Needs work

The last submitted patch, 6: metatag-n3228362-5-tests-only.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

That seems to cover it, thank you.

damienmckenna’s picture

Title: SQL error when migrating non-UTF8 metatags » SQL error when migrating non-UTF8 meta tags
Status: Needs review » Fixed
Parent issue: » #3203686: Plan for Metatag 8.x-1.17

Committed. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.