diff --git a/docs/changelogs/v4.7.7.md b/docs/changelogs/v4.7.7.md index 391c732c6639..40692b65213d 100644 --- a/docs/changelogs/v4.7.7.md +++ b/docs/changelogs/v4.7.7.md @@ -36,6 +36,7 @@ Release Date: Unreleased - **HTTP:** Fixed a bug where query-string based routing truncated additional query parameters in `SiteURIFactory::parseRequestURI()` due to incorrect array index access. - **HTTP:** Fixed a bug where `UploadedFile::move()` and `UploadedFile::store()` on Windows could store a file under a different name than `getName()` reported, or write its contents to an NTFS alternate data stream. Filenames ending in a period or space or containing a colon are now rejected, including explicitly supplied names. - **Images:** Fixed a bug in `ImageMagickHandler::save()` where saving without an extension or with an unsupported extension threw an `ImagickException` instead of falling back to the image's format. +- **Pager:** Fixed a bug where `Pager::makeLinks()` threw a `TypeError` when `$group` was `null`. - **Router:** Fixed a bug where `Router::replaceBackReferences()` failed to match and replace multi-digit back-references (such as `$10` or higher) when `Routing::$multipleSegmentsOneParam` was enabled. - **Routing:** Fixed a bug where redirect routes containing the `{locale}` placeholder were not recognized as redirects and did not replace `{locale}` in the redirect target. - **Security:** Fixed a bug where `Security::__construct()` threw a `TypeError` when the CSRF cookie was an array, causing an HTTP 500 response for affected requests. diff --git a/system/Pager/Pager.php b/system/Pager/Pager.php index 6a17a07aeee6..161770e85ba0 100644 --- a/system/Pager/Pager.php +++ b/system/Pager/Pager.php @@ -114,7 +114,7 @@ public function simpleLinks(string $group = 'default', string $template = 'defau */ public function makeLinks(int $page, ?int $perPage, int $total, string $template = 'default_full', int $segment = 0, ?string $group = 'default'): string { - $group = $group === '' ? 'default' : $group; + $group = ($group === null || $group === '') ? 'default' : $group; $this->store($group, $page, $perPage ?? $this->config->perPage, $total, $segment); diff --git a/tests/system/Pager/PagerTest.php b/tests/system/Pager/PagerTest.php index 875f5c25b320..8a628c733c9e 100644 --- a/tests/system/Pager/PagerTest.php +++ b/tests/system/Pager/PagerTest.php @@ -438,6 +438,10 @@ public function testMakeLinks(): void '?page=1', $this->pager->makeLinks(1, 10, 1, 'default_full', 0, ''), ); + $this->assertStringContainsString( + '?page=1', + $this->pager->makeLinks(1, 10, 1, 'default_full', 0, null), + ); $this->assertStringContainsString( '?page=1', $this->pager->makeLinks(1, 10, 1, 'default_full', 0, 'default'),