Skip to content

Commit 07a891f

Browse files
bug #43948 [Asset][Security] Fixed leftover deprecations PHP 8.1 (michaljusiega)
This PR was merged into the 5.3 branch. Discussion ---------- [Asset][Security] Fixed leftover deprecations PHP 8.1 | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Part of #41552, leftover #41559 | License | MIT | Doc PR | ~ Found during testing **PHP 8.1** and Symfony **5.4.0-BETA1** 1. src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php ![obraz](https://user-images.githubusercontent.com/16488888/140545163-837ea4c4-907b-44e7-8f8e-7454f7d66be3.png) Looks like #41559 didn't solve the deprecation completely. 2. src/Symfony/Component/Security/Http/Authenticator/JsonLoginAuthenticator.php ![obraz](https://user-images.githubusercontent.com/16488888/140545313-794c0136-cef8-4434-a8c2-21c3d77ef196.png) `Request::getRequestFormat()` and `Request::getContentType()` may return nulls. Commits ------- 86934e6 fixed leftover deprecations PHP 8.1
2 parents a063a28 + 86934e6 commit 07a891f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function applyVersion(string $path)
6262
private function getManifestPath(string $path): ?string
6363
{
6464
if (null === $this->manifestData) {
65-
if (null !== $this->httpClient && 0 === strpos(parse_url($this->manifestPath, \PHP_URL_SCHEME), 'http')) {
65+
if (null !== $this->httpClient && ($scheme = parse_url($this->manifestPath, \PHP_URL_SCHEME)) && 0 === strpos($scheme, 'http')) {
6666
try {
6767
$this->manifestData = $this->httpClient->request('GET', $this->manifestPath, [
6868
'headers' => ['accept' => 'application/json'],

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct(HttpUtils $httpUtils, UserProviderInterface $userPro
7070

7171
public function supports(Request $request): ?bool
7272
{
73-
if (false === strpos($request->getRequestFormat(), 'json') && false === strpos($request->getContentType(), 'json')) {
73+
if (false === strpos($request->getRequestFormat() ?? '', 'json') && false === strpos($request->getContentType() ?? '', 'json')) {
7474
return false;
7575
}
7676

0 commit comments

Comments
 (0)