[Routing] fix PhpMatcherDumper that returned numeric-indexed params that are returned besides named placeholders by preg_match
This commit is contained in:
parent
7ed3013a5b
commit
514e27a511
@ -294,7 +294,7 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// optimize parameters array
|
// optimize parameters array
|
||||||
if (($matches || $hostnameMatches) && $route->getDefaults()) {
|
if ($matches || $hostnameMatches) {
|
||||||
$vars = array();
|
$vars = array();
|
||||||
if ($hostnameMatches) {
|
if ($hostnameMatches) {
|
||||||
$vars[] = '$hostnameMatches';
|
$vars[] = '$hostnameMatches';
|
||||||
@ -307,16 +307,6 @@ EOF;
|
|||||||
$code .= sprintf(" return \$this->mergeDefaults(array_replace(%s), %s);\n"
|
$code .= sprintf(" return \$this->mergeDefaults(array_replace(%s), %s);\n"
|
||||||
, implode(', ', $vars), str_replace("\n", '', var_export($route->getDefaults(), true)));
|
, implode(', ', $vars), str_replace("\n", '', var_export($route->getDefaults(), true)));
|
||||||
|
|
||||||
} elseif ($matches || $hostnameMatches) {
|
|
||||||
|
|
||||||
if (!$matches) {
|
|
||||||
$code .= " \$matches = \$hostnameMatches;\n";
|
|
||||||
} elseif ($hostnameMatches) {
|
|
||||||
$code .= " \$matches = array_replace(\$hostnameMatches, \$matches);\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$code .= sprintf(" \$matches['_route'] = '%s';\n\n", $name);
|
|
||||||
$code .= " return \$matches;\n";
|
|
||||||
} elseif ($route->getDefaults()) {
|
} elseif ($route->getDefaults()) {
|
||||||
$code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true)));
|
$code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,9 +38,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
goto not_bar;
|
goto not_bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'bar';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_bar:
|
not_bar:
|
||||||
|
|
||||||
@ -51,9 +49,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
goto not_barhead;
|
goto not_barhead;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'barhead';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_barhead:
|
not_barhead:
|
||||||
|
|
||||||
@ -80,9 +76,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
// baz4
|
// baz4
|
||||||
if (preg_match('#^/test/(?<foo>[^/]++)/$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/test/(?<foo>[^/]++)/$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'baz4';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// baz5
|
// baz5
|
||||||
@ -92,9 +86,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
goto not_baz5;
|
goto not_baz5;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'baz5';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_baz5:
|
not_baz5:
|
||||||
|
|
||||||
@ -105,9 +97,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
goto not_bazbaz6;
|
goto not_bazbaz6;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'baz.baz6';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_bazbaz6:
|
not_bazbaz6:
|
||||||
|
|
||||||
@ -120,9 +110,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
// quoter
|
// quoter
|
||||||
if (preg_match('#^/(?<quoter>[\']+)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/(?<quoter>[\']+)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'quoter';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// space
|
// space
|
||||||
@ -134,40 +122,30 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
||||||
// foo1
|
// foo1
|
||||||
if (preg_match('#^/a/b\'b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo1';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bar1
|
// bar1
|
||||||
if (preg_match('#^/a/b\'b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'bar1';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// overridden
|
// overridden
|
||||||
if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'overridden';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
||||||
// foo2
|
// foo2
|
||||||
if (preg_match('#^/a/b\'b/(?<foo1>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<foo1>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo2';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bar2
|
// bar2
|
||||||
if (preg_match('#^/a/b\'b/(?<bar1>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<bar1>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'bar2';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -194,16 +172,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
// foo3
|
// foo3
|
||||||
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo3';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bar3
|
// bar3
|
||||||
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'bar3';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($pathinfo, '/aba')) {
|
if (0 === strpos($pathinfo, '/aba')) {
|
||||||
@ -214,9 +188,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
// foo4
|
// foo4
|
||||||
if (preg_match('#^/aba/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/aba/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo4';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -269,10 +241,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
if (0 === strpos($pathinfo, '/route1')) {
|
if (0 === strpos($pathinfo, '/route1')) {
|
||||||
// route11
|
// route11
|
||||||
if ($pathinfo === '/route11') {
|
if ($pathinfo === '/route11') {
|
||||||
$matches = $hostnameMatches;
|
return $this->mergeDefaults(array_replace($hostnameMatches, array('_route' => 'route11')), array ());
|
||||||
$matches['_route'] = 'route11';
|
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// route12
|
// route12
|
||||||
@ -282,10 +251,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
// route13
|
// route13
|
||||||
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches = array_replace($hostnameMatches, $matches);
|
return $this->mergeDefaults(array_replace($hostnameMatches, $matches, array('_route' => 'route13')), array ());
|
||||||
$matches['_route'] = 'route13';
|
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// route14
|
// route14
|
||||||
@ -300,9 +266,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
if (preg_match('#^c\\.example\\.com$#s', $hostname, $hostnameMatches)) {
|
if (preg_match('#^c\\.example\\.com$#s', $hostname, $hostnameMatches)) {
|
||||||
// route15
|
// route15
|
||||||
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'route15';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -329,16 +293,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
if (0 === strpos($pathinfo, '/a/b')) {
|
if (0 === strpos($pathinfo, '/a/b')) {
|
||||||
// b
|
// b
|
||||||
if (preg_match('#^/a/b/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'b';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// c
|
// c
|
||||||
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'c';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
goto not_bar;
|
goto not_bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'bar';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_bar:
|
not_bar:
|
||||||
|
|
||||||
@ -51,9 +49,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
goto not_barhead;
|
goto not_barhead;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'barhead';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_barhead:
|
not_barhead:
|
||||||
|
|
||||||
@ -88,9 +84,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
return $this->redirect($pathinfo.'/', 'baz4');
|
return $this->redirect($pathinfo.'/', 'baz4');
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'baz4';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// baz5
|
// baz5
|
||||||
@ -100,9 +94,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
goto not_baz5;
|
goto not_baz5;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'baz5';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_baz5:
|
not_baz5:
|
||||||
|
|
||||||
@ -113,9 +105,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
goto not_bazbaz6;
|
goto not_bazbaz6;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches['_route'] = 'baz.baz6';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
not_bazbaz6:
|
not_bazbaz6:
|
||||||
|
|
||||||
@ -128,9 +118,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
// quoter
|
// quoter
|
||||||
if (preg_match('#^/(?<quoter>[\']+)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/(?<quoter>[\']+)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'quoter';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// space
|
// space
|
||||||
@ -142,40 +130,30 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
||||||
// foo1
|
// foo1
|
||||||
if (preg_match('#^/a/b\'b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo1';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bar1
|
// bar1
|
||||||
if (preg_match('#^/a/b\'b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'bar1';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// overridden
|
// overridden
|
||||||
if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'overridden';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
||||||
// foo2
|
// foo2
|
||||||
if (preg_match('#^/a/b\'b/(?<foo1>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<foo1>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo2';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bar2
|
// bar2
|
||||||
if (preg_match('#^/a/b\'b/(?<bar1>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b\'b/(?<bar1>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'bar2';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -206,16 +184,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
// foo3
|
// foo3
|
||||||
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo3';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bar3
|
// bar3
|
||||||
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/(?<_locale>[^/]++)/b/(?<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'bar3';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($pathinfo, '/aba')) {
|
if (0 === strpos($pathinfo, '/aba')) {
|
||||||
@ -226,9 +200,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
// foo4
|
// foo4
|
||||||
if (preg_match('#^/aba/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/aba/(?<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'foo4';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -281,10 +253,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
if (0 === strpos($pathinfo, '/route1')) {
|
if (0 === strpos($pathinfo, '/route1')) {
|
||||||
// route11
|
// route11
|
||||||
if ($pathinfo === '/route11') {
|
if ($pathinfo === '/route11') {
|
||||||
$matches = $hostnameMatches;
|
return $this->mergeDefaults(array_replace($hostnameMatches, array('_route' => 'route11')), array ());
|
||||||
$matches['_route'] = 'route11';
|
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// route12
|
// route12
|
||||||
@ -294,10 +263,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
// route13
|
// route13
|
||||||
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches = array_replace($hostnameMatches, $matches);
|
return $this->mergeDefaults(array_replace($hostnameMatches, $matches, array('_route' => 'route13')), array ());
|
||||||
$matches['_route'] = 'route13';
|
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// route14
|
// route14
|
||||||
@ -312,9 +278,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
if (preg_match('#^c\\.example\\.com$#s', $hostname, $hostnameMatches)) {
|
if (preg_match('#^c\\.example\\.com$#s', $hostname, $hostnameMatches)) {
|
||||||
// route15
|
// route15
|
||||||
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?<name>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'route15';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -341,16 +305,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
if (0 === strpos($pathinfo, '/a/b')) {
|
if (0 === strpos($pathinfo, '/a/b')) {
|
||||||
// b
|
// b
|
||||||
if (preg_match('#^/a/b/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/a/b/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'b';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// c
|
// c
|
||||||
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'c';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
// dynamic
|
// dynamic
|
||||||
if (preg_match('#^/rootprefix/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
if (preg_match('#^/rootprefix/(?<var>[^/]++)$#s', $pathinfo, $matches)) {
|
||||||
$matches['_route'] = 'dynamic';
|
return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ());
|
||||||
|
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user