@@ -305,7 +305,7 @@ public static function createFromGlobals()
305305 {
306306 $ request = self ::createRequestFromFactory ($ _GET , $ _POST , [], $ _COOKIE , $ _FILES , $ _SERVER );
307307
308- if (0 === strpos ($ request ->headers ->get ('CONTENT_TYPE ' , '' ), 'application/x-www-form-urlencoded ' )
308+ if (str_starts_with ($ request ->headers ->get ('CONTENT_TYPE ' , '' ), 'application/x-www-form-urlencoded ' )
309309 && \in_array (strtoupper ($ request ->server ->get ('REQUEST_METHOD ' , 'GET ' )), ['PUT ' , 'DELETE ' , 'PATCH ' ])
310310 ) {
311311 parse_str ($ request ->getContent (), $ data );
@@ -1682,7 +1682,7 @@ public function getLanguages()
16821682 $ languages = AcceptHeader::fromString ($ this ->headers ->get ('Accept-Language ' ))->all ();
16831683 $ this ->languages = [];
16841684 foreach ($ languages as $ lang => $ acceptHeaderItem ) {
1685- if (false !== strpos ($ lang , '- ' )) {
1685+ if (str_contains ($ lang , '- ' )) {
16861686 $ codes = explode ('- ' , $ lang );
16871687 if ('i ' === $ codes [0 ]) {
16881688 // Language not listed in ISO 639 that are not variants
@@ -2007,7 +2007,7 @@ private function setPhpDefaultLocale(string $locale): void
20072007 */
20082008 private function getUrlencodedPrefix (string $ string , string $ prefix ): ?string
20092009 {
2010- if (0 !== strpos (rawurldecode ($ string ), $ prefix )) {
2010+ if (! str_starts_with (rawurldecode ($ string ), $ prefix )) {
20112011 return null ;
20122012 }
20132013
@@ -2069,7 +2069,7 @@ private function getTrustedValues(int $type, string $ip = null): array
20692069 continue ;
20702070 }
20712071 if (self ::HEADER_X_FORWARDED_PORT === $ type ) {
2072- if (' ] ' === substr ($ v , - 1 ) || false === $ v = strrchr ($ v , ': ' )) {
2072+ if (str_ends_with ($ v , ' ] ' ) || false === $ v = strrchr ($ v , ': ' )) {
20732073 $ v = $ this ->isSecure () ? ':443 ' : ':80 ' ;
20742074 }
20752075 $ v = '0.0.0.0 ' .$ v ;
@@ -2115,7 +2115,7 @@ private function normalizeAndFilterClientIps(array $clientIps, string $ip): arra
21152115 if ($ i ) {
21162116 $ clientIps [$ key ] = $ clientIp = substr ($ clientIp , 0 , $ i );
21172117 }
2118- } elseif (0 === strpos ($ clientIp , '[ ' )) {
2118+ } elseif (str_starts_with ($ clientIp , '[ ' )) {
21192119 // Strip brackets and :port from IPv6 addresses.
21202120 $ i = strpos ($ clientIp , '] ' , 1 );
21212121 $ clientIps [$ key ] = $ clientIp = substr ($ clientIp , 1 , $ i - 1 );
0 commit comments