8000 Display the Welcome Page when there is no homepage defined · symfony/symfony@5b0d934 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5b0d934

Browse files
javiereguiluzfabpot
authored andcommitted
Display the Welcome Page when there is no homepage defined
1 parent cd56299 commit 5b0d934

File tree

10 files changed

+34
-7
lines changed

10 files changed

+34
-7
lines changed

src/Symfony/Component/HttpKernel/Resources/welcome.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</div>
7777
<div id="comment">
7878
<p>
79-
You're seeing this message because you have debug mode enabled and you haven't configured any URLs.
79+
You're seeing this page because debug mode is enabled and you haven't configured any homepage URL.
8080
</p>
8181
</div>
8282
</div>

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,10 @@ private function compileRoutes(RouteCollection $routes, $supportsRedirections)
153153
}
154154
}
155155

156-
if ('' === $code) {
157-
$code .= " if ('/' === \$pathinfo) {\n";
158-
$code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
159-
$code .= " }\n";
160-
}
156+
// used to display the Welcome Page in apps that don't define a homepage
157+
$code .= " if ('/' === \$pathinfo) {\n";
158+
$code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
159+
$code .= " }\n";
161160

162161
return $code;
163162
}

src/Symfony/Component/Routing/Matcher/UrlMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function match($pathinfo)
7676
return $ret;
7777
}
7878

79-
if (0 === count($this->routes) && '/' === $pathinfo) {
79+
if ('/' === $pathinfo) {
8080
throw new NoConfigurationException();
8181
}
8282

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ public function match($rawPathinfo)
305305

306306
}
307307

308+
if ('/' === $pathinfo) {
309+
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
310+
}
311+
308312
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
309313
}
310314
}

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ public function match($rawPathinfo)
357357
return $ret;
358358
}
359359

360+
if ('/' === $pathinfo) {
361+
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
362+
}
363+
360364
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
361365
}
362366
}

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public function match($rawPathinfo)
4646
return array('_route' => 'with-condition');
4747
}
4848

49+
if ('/' === $pathinfo) {
50+
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
51+
}
52+
4953
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
5054
}
5155
}

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ public function match($rawPathinfo)
9797

9898
}
9999

100+
if ('/' === $pathinfo) {
101+
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
102+
}
103+
100104
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
101105
}
102106
}

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ public function match($rawPathinfo)
200200

201201
}
202202

203+
if ('/' === $pathinfo) {
204+
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
205+
}
206+
203207
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
204208
}
205209
}

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ public function match($rawPathinfo)
192192

193193
}
194194

195+
if ('/' === $pathinfo) {
196+
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
197+
}
198+
195199
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
196200
}
197201
}

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ public function match($rawPathinfo)
248248

249249
}
250250

251+
if ('/' === $pathinfo) {
252+
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
253+
}
254+
251255
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
252256
}
253257
}

0 commit comments

Comments
 (0)
0