diff --git a/CHANGELOG.md b/CHANGELOG.md index 45fb24c2b..474e16a22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * Fixed saving page in expert mode [#3174](https://github.com/getgrav/grav/issues/3174) * Fixed exception in `$flexPage->frontmatter()` method when setting value * Fixed `onBlueprintCreated` event being called multiple times in `Flex Pages` [grav-plugin-flex-objects#97](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/97) + * Fixed wrong ordering in page collections if `intl` extension has been enabled [#3167](https://github.com/getgrav/grav/issues/3167) # v1.7.3 ## 01/21/2021 diff --git a/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php b/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php index e7f857773..0732cf91a 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php +++ b/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php @@ -362,6 +362,7 @@ class PageCollection extends FlexPageCollection implements PageCollectionInterfa $locale = setlocale(LC_COLLATE, '0'); //`setlocale` with a '0' param returns the current locale set $col = Collator::create($locale); if ($col) { + $col->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON); if (($sort_flags & SORT_NATURAL) === SORT_NATURAL) { $list = preg_replace_callback('~([0-9]+)\.~', static function ($number) { return sprintf('%032d.', $number[0]); diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 82b139cda..ea95586f1 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -1955,6 +1955,7 @@ class Pages $locale = setlocale(LC_COLLATE, '0'); //`setlocale` with a '0' param returns the current locale set $col = Collator::create($locale); if ($col) { + $col->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON); if (($sort_flags & SORT_NATURAL) === SORT_NATURAL) { $list = preg_replace_callback('~([0-9]+)\.~', static function ($number) { return sprintf('%032d.', $number[0]);