MySQL: JSON-Schlüsselreihenfolge darf keine Rolle spielen
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m40s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m23s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m53s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m2s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m5s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 2m50s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 2m41s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m40s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m23s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m53s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m2s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m5s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 2m50s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 2m41s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
MySQL speichert Schlüssel in JSON-Spalten sortiert, MariaDB unverändert. - Seiten: „Stand unverändert → kein Entwurf“ vergleicht jetzt unabhängig von der Schlüsselreihenfolge (auf MySQL entstand sonst bei jedem Speichern ein Entwurf) - Formulare: Antworten in Ergebnisansicht und E-Mail in der Reihenfolge des Formulars - Tests vergleichen assoziative Arrays ohne Reihenfolge; neue Tests dafür Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
21c706e5f5
commit
2b5fe55f8e
9 changed files with 92 additions and 6 deletions
|
|
@ -78,6 +78,31 @@ class Content
|
|||
return $type?->resolve ? $this->resolve($type, $clean, $user, $context) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gleicher Inhalt? Unabhängig von der Reihenfolge der Schlüssel – MySQL
|
||||
* sortiert Schlüssel in JSON-Spalten um, MariaDB nicht.
|
||||
*
|
||||
* @param array<mixed>|null $a
|
||||
* @param array<mixed>|null $b
|
||||
*/
|
||||
public static function same(?array $a, ?array $b): bool
|
||||
{
|
||||
return self::canonical($a) === self::canonical($b);
|
||||
}
|
||||
|
||||
private static function canonical(mixed $value): mixed
|
||||
{
|
||||
if (! is_array($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (! array_is_list($value)) {
|
||||
ksort($value);
|
||||
}
|
||||
|
||||
return array_map(self::canonical(...), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle Werte eines Feldtyps im Baum, z. B. alle Bildpfade (für Aufräumarbeiten).
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue