@@ -187,7 +187,7 @@ private function groupStaticRoutes(RouteCollection $collection): array
187187 $ url = substr ($ url , 0 , -1 );
188188 }
189189 foreach ($ dynamicRegex as [$ hostRx , $ rx , $ prefix ]) {
190- if (('' === $ prefix || 0 === strpos ($ url , $ prefix )) && (preg_match ($ rx , $ url ) || preg_match ($ rx , $ url .'/ ' )) && (!$ host || !$ hostRx || preg_match ($ hostRx , $ host ))) {
190+ if (('' === $ prefix || str_starts_with ($ url , $ prefix )) && (preg_match ($ rx , $ url ) || preg_match ($ rx , $ url .'/ ' )) && (!$ host || !$ hostRx || preg_match ($ hostRx , $ host ))) {
191191 $ dynamicRegex [] = [$ hostRegex , $ regex , $ staticPrefix ];
192192 $ dynamicRoutes ->add ($ name , $ route );
193193 continue 2 ;
@@ -349,7 +349,7 @@ private function compileDynamicRoutes(RouteCollection $collection, bool $matchHo
349349 $ state ->markTail = 0 ;
350350
351351 // if the regex is too large, throw a signaling exception to recompute with smaller chunk size
352- set_error_handler (function ($ type , $ message ) { throw false !== strpos ($ message , $ this ->signalingException ->getMessage ()) ? $ this ->signalingException : new \ErrorException ($ message ); });
352+ set_error_handler (function ($ type , $ message ) { throw str_contains ($ message , $ this ->signalingException ->getMessage ()) ? $ this ->signalingException : new \ErrorException ($ message ); });
353353 try {
354354 preg_match ($ state ->regex , '' );
355355 } finally {
@@ -427,7 +427,7 @@ private function compileRoute(Route $route, string $name, $vars, bool $hasTraili
427427
428428 if ($ condition = $ route ->getCondition ()) {
429429 $ condition = $ this ->getExpressionLanguage ()->compile ($ condition , ['context ' , 'request ' ]);
430- $ condition = $ conditions [$ condition ] ?? $ conditions [$ condition ] = (false !== strpos ($ condition , '$request ' ) ? 1 : -1 ) * \count ($ conditions );
430+ $ condition = $ conditions [$ condition ] ?? $ conditions [$ condition ] = (str_contains ($ condition , '$request ' ) ? 1 : -1 ) * \count ($ conditions );
431431 } else {
432432 $ condition = null ;
433433 }
0 commit comments