Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.5] fix: TypeError in Filters #8683

Merged
merged 3 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion system/Filters/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ private function setToolbarToLast(array $filters, bool $remove = false): array
*
* @param string|null $uri URI path relative to baseURL (all lowercase)
*
* @TODO We don't need to accept null as $uri.
*
* @return Filters
*/
public function initialize(?string $uri = null)
Expand All @@ -385,7 +387,7 @@ public function initialize(?string $uri = null)
}

// Decode URL-encoded string
$uri = urldecode($uri);
$uri = urldecode($uri ?? '');

$oldFilterOrder = config(Feature::class)->oldFilterOrder ?? false;
if ($oldFilterOrder) {
Expand Down
5 changes: 5 additions & 0 deletions tests/system/Commands/Utilities/ConfigCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function testGetKintD()
public 'allowedHostnames' -> array (0) []
public 'indexPage' -> string (9) "index.php"
public 'uriProtocol' -> string (11) "REQUEST_URI"
public 'permittedURIChars' -> string (14) "a-z 0-9~%.:_\-"
public 'defaultLocale' -> string (2) "en"
public 'negotiateLocale' -> boolean false
public 'supportedLocales' -> array (1) [
Expand Down Expand Up @@ -150,6 +151,8 @@ public function testGetVarDump()
string(9) "index.php"
public string $uriProtocol =>
string(11) "REQUEST_URI"
public string $permittedURIChars =>
string(14) "a-z 0-9~%.:_\-"
public string $defaultLocale =>
string(2) "en"
public bool $negotiateLocale =>
Expand Down Expand Up @@ -192,6 +195,8 @@ public function testGetVarDump()
string(9) "index.php"
["uriProtocol"]=>
string(11) "REQUEST_URI"
["permittedURIChars"]=>
string(14) "a-z 0-9~%.:_\-"
["defaultLocale"]=>
string(2) "en"
["negotiateLocale"]=>
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Filters/FiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,8 @@ public function testMatchesURIWithUnicode(): void
'frak',
],
'after' => [
'baz',
'frak',
'baz',
],
];
$this->assertSame($expected, $filters->initialize($uri)->getFilters());
Expand Down
Loading