Commit 0b9df659 authored by Stefan Bürk's avatar Stefan Bürk
Browse files

[BUGFIX] Ensure deterministic sorting in `PageTreeRepository`

Using database queries without deterministic sorting
definition may lead to unreliabe resultsets in some
dbms type and version, which also may change over time.
Thus it's good practice to have proper defined sorting
for queries, at least if result relies on a constant
and reliable result sorting.

With #96512 and #97774 additional tests has been added,
which showed the unreliable of these database queries,
blocking the bugfix backport to TYPO3 v10.4.

This patch adds sorting definition to two db queries in
to ensure consistent results in a deterministic manner
and make it possible to provide the related bugfix for
TYPO3 v10.4.

Resolves: #98056
Related: #96512
Related: #97774
Releases: main, 11.5, 10.4
Change-Id: I8a1bf3b93bcfcaec4c3de3ea6321db62847d0c21

Tested-by: core-ci's avatarcore-ci <>
Tested-by: Christian Kuhn's avatarChristian Kuhn <>
Tested-by: Nikita Hovratov's avatarNikita Hovratov <>
Tested-by: Stefan Bürk's avatarStefan Bürk <>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <>
Reviewed-by: Oliver Klee's avatarOliver Klee <>
Reviewed-by: Nikita Hovratov's avatarNikita Hovratov <>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <>
parent 6193f3fb
......@@ -232,7 +232,10 @@ class PageTreeRepository
// ensure deterministic sorting
->orderBy('sorting', 'ASC')
->addOrderBy('uid', 'ASC');
if (count($pageIds) > 0) {
......@@ -284,6 +287,9 @@ class PageTreeRepository
$queryBuilder->expr()->in('uid', $queryBuilder->createNamedParameter($recordIds, Connection::PARAM_INT_ARRAY))
// ensure deterministic sorting
->orderBy('sorting', 'ASC')
->addOrderBy('uid', 'ASC')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment