Skip to content

Commit 8d6fb4f

Browse files
Merge branch '4.4' into 5.2
* 4.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 91e8a5b + ffd0ba0 commit 8d6fb4f

5 files changed

+6
-6
lines changed

Firewall/ChannelListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function supports(Request $request): ?bool
4949
if (null !== $this->logger) {
5050
if ('https' === $request->headers->get('X-Forwarded-Proto')) {
5151
$this->logger->info('Redirecting to HTTPS. ("X-Forwarded-Proto" header is set to "https" - did you set "trusted_proxies" correctly?)');
52-
} elseif (false !== strpos($request->headers->get('Forwarded'), 'proto=https')) {
52+
} elseif (str_contains($request->headers->get('Forwarded'), 'proto=https')) {
5353
$this->logger->info('Redirecting to HTTPS. ("Forwarded" header is set to "proto=https" - did you set "trusted_proxies" correctly?)');
5454
} else {
5555
$this->logger->info('Redirecting to HTTPS.');

Firewall/UsernamePasswordJsonAuthenticationListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
7979

8080
public function supports(Request $request): ?bool
8181
{
82-
if (false === strpos($request->getRequestFormat() ?? '', 'json')
83-
&& false === strpos($request->getContentType() ?? '', 'json')
82+
if (!str_contains($request->getRequestFormat() ?? '', 'json')
83+
&& !str_contains($request->getContentType() ?? '', 'json')
8484
) {
8585
return false;
8686
}

HttpUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function checkRequestPath(Request $request, string $path)
148148
*/
149149
public function generateUri(Request $request, string $path)
150150
{
151-
if (0 === strpos($path, 'http') || !$path) {
151+
if (str_starts_with($path, 'http') || !$path) {
152152
return $path;
153153
}
154154

RememberMe/AbstractRememberMeServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ protected function decodeCookie(string $rawCookie)
261261
protected function encodeCookie(array $cookieParts)
262262
{
263263
foreach ($cookieParts as $cookiePart) {
264-
if (false !== strpos($cookiePart, self::COOKIE_DELIMITER)) {
264+
if (str_contains($cookiePart, self::COOKIE_DELIMITER)) {
265265
throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s".', self::COOKIE_DELIMITER));
266266
}
267267
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"symfony/http-foundation": "^5.2",
2323
"symfony/http-kernel": "^5.2",
2424
"symfony/polyfill-mbstring": "~1.0",
25-
"symfony/polyfill-php80": "^1.15",
25+
"symfony/polyfill-php80": "^1.16",
2626
"symfony/property-access": "^4.4|^5.0"
2727
},
2828
"require-dev": {

0 commit comments

Comments
 (0)