8000 merged branch pborreli/patch-3 (PR #6038) · rvdbogerd/symfony@a5aed62 · GitHub
[go: up one dir, main page]

Skip to content

Commit a5aed62

Browse files
committed
merged branch pborreli/patch-3 (PR symfony#6038)
This PR was merged into the master branch. Commits ------- a146156 Merge pull request symfony#2 from Tobion/patch-2 38802ea remove logic that could not be triggered anyway f7ea68f [Routing] Fixed undefined variable + typo Discussion ---------- [Routing] Fixed typo + removed dead code --------------------------------------------------------------------------- by Tobion at 2012-11-17T16:00:04Z @pborreli: pborreli/symfony#2 --------------------------------------------------------------------------- by pborreli at 2012-11-17T16:02:08Z @Tobion totally agree, tried to setup a phpunit test which could trigger this exception but couldn't ..
2 parents 4ad1e14 + a146156 commit a5aed62

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ public function dump(array $options = array())
4747
$rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]");
4848
$methodVars = array();
4949
$hostnameRegexUnique = 0;
50-
$prevHosnameRegex = '';
50+
$prevHostnameRegex = '';
5151

5252
foreach ($this->getRoutes()->all() as $name => $route) {
5353

5454
$compiledRoute = $route->compile();
5555
$hostnameRegex = $compiledRoute->getHostnameRegex();
5656

57-
if (null !== $hostnameRegex && $prevHosnameRegex !== $hostnameRegex) {
57+
if (null !== $hostnameRegex && $prevHostnameRegex !== $hostnameRegex) {
5858

59-
$prevHosnameRegex = $hostnameRegex;
59+
$prevHostnameRegex = $hostnameRegex;
6060
$hostnameRegexUnique++;
6161

6262
$rule = array();
@@ -214,14 +214,9 @@ private function getRouteMethods(Route $route)
214214
*/
215215
private function regexToApacheRegex($regex)
216216
{
217-
$delimiter = $regex[0];
218-
$regexPatternEnd = strrpos($regex, $delimiter);
219-
if (strlen($regex) < 2 || 0 === $regexPatternEnd) {
220-
throw new \LogicException('The "%s" route regex "%s" is invalid', $name, $regex);
221-
}
222-
$regex = preg_replace('/\?<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1));
217+
$regexPatternEnd = strrpos($regex, $regex[0]);
223218

224-
return $regex;
219+
return preg_replace('/\?<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1));
225220
}
226221

227222
/**

0 commit comments

Comments
 (0)
0