Skip to content

Commit 28da6fe

Browse files
authored
fix(Pager): handle null group in Pager::makeLinks() (#10781)
1 parent 1f868a5 commit 28da6fe

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎docs/changelogs/v4.7.7.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Release Date: Unreleased
3636
- **HTTP:** Fixed a bug where query-string based routing truncated additional query parameters in `SiteURIFactory::parseRequestURI()` due to incorrect array index access.
3737
- **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.
3838
- **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.
39+
- **Pager:** Fixed a bug where `Pager::makeLinks()` threw a `TypeError` when `$group` was `null`.
3940
- **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.
4041
- **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.
4142
- **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.

‎system/Pager/Pager.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function simpleLinks(string $group = 'default', string $template = 'defau
114114
*/
115115
public function makeLinks(int $page, ?int $perPage, int $total, string $template = 'default_full', int $segment = 0, ?string $group = 'default'): string
116116
{
117-
$group = $group === '' ? 'default' : $group;
117+
$group = ($group === null || $group === '') ? 'default' : $group;
118118

119119
$this->store($group, $page, $perPage ?? $this->config->perPage, $total, $segment);
120120

‎tests/system/Pager/PagerTest.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ public function testMakeLinks(): void
438438
'?page=1',
439439
$this->pager->makeLinks(1, 10, 1, 'default_full', 0, ''),
440440
);
441+
$this->assertStringContainsString(
442+
'?page=1',
443+
$this->pager->makeLinks(1, 10, 1, 'default_full', 0, null),
444+
);
441445
$this->assertStringContainsString(
442446
'?page=1',
443447
$this->pager->makeLinks(1, 10, 1, 'default_full', 0, 'default'),

0 commit comments

Comments
 (0)