Skip to content

Inconsistent escaping during database migration with MySQL #39491

Open
@LouisdeLooze

Description

@LouisdeLooze

Preconditions and environment

  • Clean Magento 2.4.7-p3
  • Reproducible on MySQL 8, cannot be reproduced on MariaDB 10.6

Steps to reproduce

  1. Make custom module with a declarative schema that contains a PHP class as default. For example:
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="test_module_db" resource="default" engine="innodb">
        <column xsi:type="varchar" name="model" nullable="true" default="Test\\Module\\Model\\Default" comment="Corresponding Model"/>
    </table>
</schema>
  1. Run setup:upgrade
  2. Run setup:db:status

Expected result

No database migrations needed, just ran the migrations.

Actual result

Migration is needed (breaking zero-downtime deployments for no reason), this is the difference:
from xml:

array(5) {
  ["type"]=>
  string(7) "varchar"
  ["nullable"]=>
  bool(true)
  ["default"]=>
  string(28) "Test\\Module\\Model\\Default"
  ["length"]=>
  int(255)
  ["comment"]=>
  string(19) "Corresponding Model"
}

from MySQL:

array(5) {
  ["type"]=>
  string(7) "varchar"
  ["nullable"]=>
  bool(true)
  ["default"]=>
  string(25) "Test\Module\Model\Default"
  ["length"]=>
  int(255)
  ["comment"]=>
  string(19) "Corresponding Model"
}

for reference, MariaDB:

array(5) {
  ["type"]=>
  string(7) "varchar"
  ["nullable"]=>
  bool(true)
  ["default"]=>
  string(25) "Test\\Module\\Model\\Default"
  ["length"]=>
  int(255)
  ["comment"]=>
  string(19) "Corresponding Model"
}

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: Framework/DBUSE ONLY for FRAMEWORK RELATED BUG!Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.7-p3Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions