PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-database-schema-checker.php +11 -2 6.2 → 6.2.1 View file →
@@ -578,8 +578,11 @@
578 578
579 579 /**
580 580 * Normalize a column definition for comparison.
581 581 *
582 + * Explicit and implicit nullable forms, including DEFAULT NULL, compare
583 + * as the same definition MySQL reports when the default is omitted.
584 + *
582 585 * @param string $definition Column definition.
583 586 *
584 587 * @return string
585 588 */
@@ -612,16 +615,22 @@
612 615 $definition
613 616 );
614 617
615 618 // Normalize NULL handling.
619 + // MySQL reports an explicit NULL default as no default at all.
620 + // Remove that default before the nullable marker so both forms compare equal.
621 + // Quoted literals are skipped, including escapes and doubled quotes, so a
622 + // default value that contains this text is left intact.
623 + $quoted = '/(?:\'(?:\'\'|\\\\.|[^\'\\\\])*\'|"(?:\\\\.|""|[^"\\\\])*")(*SKIP)(*F)|';
624 +
616 625 $definition = preg_replace(
617 - '/(?<!NOT)\s+NULL\s+DEFAULT\s+NULL\b/',
626 + $quoted . '\s+DEFAULT\s+NULL\b/',
618 627 '',
619 628 $definition
620 629 );
621 630
622 631 $definition = preg_replace(
623 - '/(?<!NOT)\s+NULL\b/',
632 + $quoted . '(?<!NOT)\s+NULL\b/',
624 633 '',
625 634 $definition
626 635 );
627 636