Display the Welcome Page when there is no homepage defined

This commit is contained in:
Javier Eguiluz 2018-02-04 17:33:12 +01:00 committed by Fabien Potencier
parent cd56299c14
commit 5b0d9340d7
10 changed files with 34 additions and 7 deletions

View File

@ -76,7 +76,7 @@
</div> </div>
<div id="comment"> <div id="comment">
<p> <p>
You're seeing this message because you have debug mode enabled and you haven't configured any URLs. You're seeing this page because debug mode is enabled and you haven't configured any homepage URL.
</p> </p>
</div> </div>
</div> </div>

View File

@ -153,11 +153,10 @@ EOF;
} }
} }
if ('' === $code) { // used to display the Welcome Page in apps that don't define a homepage
$code .= " if ('/' === \$pathinfo) {\n"; $code .= " if ('/' === \$pathinfo) {\n";
$code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n"; $code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
$code .= " }\n"; $code .= " }\n";
}
return $code; return $code;
} }

View File

@ -76,7 +76,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
return $ret; return $ret;
} }
if (0 === count($this->routes) && '/' === $pathinfo) { if ('/' === $pathinfo) {
throw new NoConfigurationException(); throw new NoConfigurationException();
} }

View File

@ -305,6 +305,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
} }
if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
} }
} }

View File

@ -357,6 +357,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
return $ret; return $ret;
} }
if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
} }
} }

View File

@ -46,6 +46,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
return array('_route' => 'with-condition'); return array('_route' => 'with-condition');
} }
if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
} }
} }

View File

@ -97,6 +97,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
} }
if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
} }
} }

View File

@ -200,6 +200,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
} }
if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
} }
} }

View File

@ -192,6 +192,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
} }
if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
} }
} }

View File

@ -248,6 +248,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
} }
if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
} }
} }