Skip to content

Commit

Permalink
Fixed #16432
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jan 15, 2025
1 parent 01c2875 commit 67d005e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
- Image cleansing now preserves the original image quality, if known.
- Fixed a bug where `craft\config\GeneralConfig::safeMode()` set Safe Mode to `false` by default.
- Fixed a bug where Craft wasn’t auto-rotating or flipping images uploaded with a mirrored EXIF orientation.
- Fixed a bug where elements weren’t getting returned in a consistent order when `orderBy` was set to `RAND(X)` across varying `limit` param values. ([#16432](https://github.com/craftcms/cms/issues/16432))
- Updated Twig to 3.15. ([#16207](https://github.com/craftcms/cms/discussions/16207))
3 changes: 2 additions & 1 deletion src/elements/db/ElementQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -3051,7 +3051,8 @@ private function _applyOrderByParams(YiiConnection $db): void
unset($direction);
}

$this->query->orderBy($orderBy);
// No need to set orderBy on $this->query. And doing so breaks RAND(X).
// (see https://github.com/craftcms/cms/issues/16432)
$this->subQuery->orderBy($orderBy);
}

Expand Down

0 comments on commit 67d005e

Please sign in to comment.