Skip to content
Snippets Groups Projects
Unverified Commit 5368b3d3 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3305621 by longwave, Wim Leers:...

Issue #3305621 by longwave, Wim Leers: HTMLRestrictions::mergeAllowedElementsLevel() fails when merging <ol type="1">

(cherry picked from commit 1921b1bd)
(cherry picked from commit 13884e1b)
parent 7512b901
No related branches found
No related tags found
No related merge requests found
......@@ -768,8 +768,11 @@ private static function mergeAllowedElementsLevel(array $array1, array $array2):
}
// Make sure the order of the union array matches the order of the keys in
// the arrays provided.
$keys_order = array_merge($array1_keys, $array2_keys);
return array_merge(array_flip($keys_order), $union);
$ordered = [];
foreach (array_merge($array1_keys, $array2_keys) as $key) {
$ordered[$key] = $union[$key];
}
return $ordered;
}
/**
......
......@@ -997,6 +997,13 @@ public function providerOperands(): \Generator {
'intersection' => 'a',
'union' => 'b',
];
yield 'attribute restrictions are the same: <ol type="1"> vs <ol type="1">' => [
'a' => new HTMLRestrictions(['ol' => ['type' => ['1' => TRUE]]]),
'b' => new HTMLRestrictions(['ol' => ['type' => ['1' => TRUE]]]),
'diff' => HTMLRestrictions::emptySet(),
'intersection' => 'a',
'union' => 'a',
];
// Complex cases.
yield 'attribute restrictions are different: <a hreflang="en"> vs <strong>' => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment