Skip to content

Commit ef5bb38

Browse files
javiereguiluzfabpot
authored andcommitted
Display the Welcome Page when there is no homepage defined
1 parent 0fa7200 commit ef5bb38

File tree

9 files changed

+33
-6
lines changed

9 files changed

+33
-6
lines changed

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
}

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

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
}

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
}

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
}

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
}

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
}

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
}

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)