8000 [RateLimiter] Adding default empty value · symfony/symfony@0fdfcae · GitHub
[go: up one dir, main page]

Skip to content

Commit 0fdfcae

Browse files
authored
[RateLimiter] Adding default empty value
Because Security::LAST_USERNAME not always exist, it can trigger a "preg_match(): Argument #2 ($subject) must be of type string" if $username is null
1 parent c9a5155 commit 0fdfcae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Security/Http/RateLimiter/DefaultLoginRateLimiter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(RateLimiterFactory $globalFactory, RateLimiterFactor
3737

3838
protected function getLimiters(Request $request): array
3939
{
40-
$username = $request->attributes->get(Security::LAST_USERNAME);
40+
$username = $request->attributes->get(Security::LAST_USERNAME, '');
4141
$username = preg_match('//u', $username) ? mb_strtolower($username, 'UTF-8') : strtolower($username);
4242

4343
return [

0 commit comments

Comments
 (0)
0