소스 검색

Symfony\Component\Routing\Route::setRequirements() _method requirement can be an array, no substr on it

Sébastien HOUZE 14 년 전
부모
커밋
179fe8e623
1개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 8 6
      src/Symfony/Component/Routing/Route.php

+ 8 - 6
src/Symfony/Component/Routing/Route.php

@@ -197,12 +197,14 @@ class Route
     {
         $this->requirements = array();
         foreach ($requirements as $key => $regex) {
-            if ('^' == $regex[0]) {
-                $regex = substr($regex, 1);
-            }
-
-            if ('$' == substr($regex, -1)) {
-                $regex = substr($regex, 0, -1);
+            if (!is_array($regex)) {
+                if ('^' == $regex[0]) {
+                    $regex = substr($regex, 1);
+                }
+
+                if ('$' == substr($regex, -1)) {
+                    $regex = substr($regex, 0, -1);
+                }
             }
 
             $this->requirements[$key] = $regex;