Skip to content

Commit f949c8c

Browse files
committed
Fix deprecations from getContentType
1 parent c2c3b20 commit f949c8c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Symfony/Component/Security/Http/Authenticator/FormLoginAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function supports(Request $request): bool
7575
{
7676
return ($this->options['post_only'] ? $request->isMethod('POST') : true)
7777
&& $this->httpUtils->checkRequestPath($request, $this->options['check_path'])
78-
&& ($this->options['form_only'] ? 'form' === $request->getContentType() : true);
78+
&& ($this->options['form_only'] ? 'form' === (method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat) : $request->getContentType()) : true);
7979
}
8080

8181
public function authenticate(Request $request): Passport

src/Symfony/Component/Security/Http/Authenticator/JsonLoginAuthenticator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ public function __construct(HttpUtils $httpUtils, UserProviderInterface $userPro
6565

6666
public function supports(Request $request): ?bool
6767
{
68-
if (!str_contains($request->getRequestFormat() ?? '', 'json') && !str_contains($request->getContentType() ?? '', 'json')) {
68+
if (
69+
!str_contains($request->getRequestFormat() ?? '', 'json')
70+
&& !str_contains((method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType()) ?? '', 'json')
71+
) {
6972
return false;
7073
}
7174

0 commit comments

Comments
 (0)