merged branch pborreli/patch-3 (PR #6038)
This PR was merged into the master branch. Commits -------a146156
Merge pull request #2 from Tobion/patch-238802ea
remove logic that could not be triggered anywayf7ea68f
[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 ..
This commit is contained in:
commit
a5aed62082
@ -47,16 +47,16 @@ class ApacheMatcherDumper extends MatcherDumper
|
||||
$rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]");
|
||||
$methodVars = array();
|
||||
$hostnameRegexUnique = 0;
|
||||
$prevHosnameRegex = '';
|
||||
$prevHostnameRegex = '';
|
||||
|
||||
foreach ($this->getRoutes()->all() as $name => $route) {
|
||||
|
||||
$compiledRoute = $route->compile();
|
||||
$hostnameRegex = $compiledRoute->getHostnameRegex();
|
||||
|
||||
if (null !== $hostnameRegex && $prevHosnameRegex !== $hostnameRegex) {
|
||||
if (null !== $hostnameRegex && $prevHostnameRegex !== $hostnameRegex) {
|
||||
|
||||
$prevHosnameRegex = $hostnameRegex;
|
||||
$prevHostnameRegex = $hostnameRegex;
|
||||
$hostnameRegexUnique++;
|
||||
|
||||
$rule = array();
|
||||
@ -214,14 +214,9 @@ class ApacheMatcherDumper extends MatcherDumper
|
||||
*/
|
||||
private function regexToApacheRegex($regex)
|
||||
{
|
||||
$delimiter = $regex[0];
|
||||
$regexPatternEnd = strrpos($regex, $delimiter);
|
||||
if (strlen($regex) < 2 || 0 === $regexPatternEnd) {
|
||||
throw new \LogicException('The "%s" route regex "%s" is invalid', $name, $regex);
|
||||
}
|
||||
$regex = preg_replace('/\?<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1));
|
||||
$regexPatternEnd = strrpos($regex, $regex[0]);
|
||||
|
||||
return $regex;
|
||||
return preg_replace('/\?<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user