Skip to content

splitSql in MigrateCommand breaks queries with utf8 (non-ASCII) characters #10

Description

@arion-p

When a migration sql query contains non-ASCII utf8 characters, the migration may fail with the following error:
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xCF\x0A\xCF\x80\xCE\xBF...'
(the exact string may be different but the 2nd or 3rd character typically is 0x0A which is invalide after e.g. 0xCF)

The problem is that splitSql uses two regulare expressions that do not take into account utf8 and may split between bytes of a multibyte sequence. The result is an invalid multibyte utf8 sequence.

The solution is simple, add the /u modifier on each regex.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions