Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b4edd1

Browse files
committed
methods param can be a string
1 parent28a9102 commit0b4edd1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

‎src/Symfony/Component/Security/Http/Attribute/IsCsrfTokenValid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public function __construct(
2828
public ?string$tokenKey ='_token',
2929

3030
/**
31-
* Sets the availablehttps methods that can be used to validate the token.
31+
* Sets the availablehttp methods that can be used to validate the token.
3232
* If not set, the token will be validated for all methods.
3333
*/
34-
public?array$methods =null,
34+
publicarray|string$methods =[],
3535
) {
3636
}
3737
}

‎src/Symfony/Component/Security/Http/EventListener/IsCsrfTokenValidAttributeListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function onKernelControllerArguments(ControllerArgumentsEvent $event): vo
4747
$id =$this->getTokenId($attribute->id,$request,$arguments);
4848
$methods =$attribute->methods;
4949

50-
if (null !==$methods && !\in_array($request->getMethod(),$methods,true)) {
50+
if ($methods && !\in_array($request->getMethod(), (array)$methods,true)) {
5151
continue;
5252
}
5353

‎src/Symfony/Component/Security/Http/Tests/Fixtures/IsCsrfTokenValidAttributeMethodsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function withInvalidTokenKey()
4545
{
4646
}
4747

48-
#[IsCsrfTokenValid('foo', methods:['DELETE'])]
48+
#[IsCsrfTokenValid('foo', methods:'DELETE')]
4949
publicfunctionwithDeleteMethod()
5050
{
5151
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp