Merge branch 'fix/mysql-json' into phase-6
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m13s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m8s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m24s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m21s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m28s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m13s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m0s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 2m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s

This commit is contained in:
Friederich Loheide 2026-09-26 11:38:24 +00:00
commit 0ab0838050
9 changed files with 92 additions and 6 deletions

View file

@ -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).
*