@@ -306,7 +306,7 @@ public static function createFromGlobals()
306306
307307 if ($ _POST ) {
308308 $ request ->request = new InputBag ($ _POST );
309- } elseif (0 === strpos ($ request ->headers ->get ('CONTENT_TYPE ' , '' ), 'application/x-www-form-urlencoded ' )
309+ } elseif (str_starts_with ($ request ->headers ->get ('CONTENT_TYPE ' , '' ), 'application/x-www-form-urlencoded ' )
310310 && \in_array (strtoupper ($ request ->server ->get ('REQUEST_METHOD ' , 'GET ' )), ['PUT ' , 'DELETE ' , 'PATCH ' ])
311311 ) {
312312 parse_str ($ request ->getContent (), $ data );
@@ -1683,7 +1683,7 @@ public function getLanguages()
16831683 $ languages = AcceptHeader::fromString ($ this ->headers ->get ('Accept-Language ' ))->all ();
16841684 $ this ->languages = [];
16851685 foreach ($ languages as $ lang => $ acceptHeaderItem ) {
1686- if (false !== strpos ($ lang , '- ' )) {
1686+ if (str_contains ($ lang , '- ' )) {
16871687 $ codes = explode ('- ' , $ lang );
16881688 if ('i ' === $ codes [0 ]) {
16891689 // Language not listed in ISO 639 that are not variants
@@ -2008,7 +2008,7 @@ private function setPhpDefaultLocale(string $locale): void
20082008 */
20092009 private function getUrlencodedPrefix (string $ string , string $ prefix ): ?string
20102010 {
2011- if (0 !== strpos (rawurldecode ($ string ), $ prefix )) {
2011+ if (! str_starts_with (rawurldecode ($ string ), $ prefix )) {
20122012 return null ;
20132013 }
20142014
@@ -2070,7 +2070,7 @@ private function getTrustedValues(int $type, string $ip = null): array
20702070 continue ;
20712071 }
20722072 if (self ::HEADER_X_FORWARDED_PORT === $ type ) {
2073- if (' ] ' === substr ($ v , - 1 ) || false === $ v = strrchr ($ v , ': ' )) {
2073+ if (str_ends_with ($ v , ' ] ' ) || false === $ v = strrchr ($ v , ': ' )) {
20742074 $ v = $ this ->isSecure () ? ':443 ' : ':80 ' ;
20752075 }
20762076 $ v = '0.0.0.0 ' .$ v ;
@@ -2116,7 +2116,7 @@ private function normalizeAndFilterClientIps(array $clientIps, string $ip): arra
21162116 if ($ i ) {
21172117 $ clientIps [$ key ] = $ clientIp = substr ($ clientIp , 0 , $ i );
21182118 }
2119- } elseif (0 === strpos ($ clientIp , '[ ' )) {
2119+ } elseif (str_starts_with ($ clientIp , '[ ' )) {
21202120 // Strip brackets and :port from IPv6 addresses.
21212121 $ i = strpos ($ clientIp , '] ' , 1 );
21222122 $ clientIps [$ key ] = $ clientIp = substr ($ clientIp , 1 , $ i - 1 );
0 commit comments