Skip to content

Display the Welcome Page when there is no homepage defined #26041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</div>
<div id="comment">
<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>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ private function compileRoutes(RouteCollection $routes, $supportsRedirections)
}
}

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

return $code;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Matcher/UrlMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function match($pathinfo)
return $ret;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ public function match($rawPathinfo)

}

if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}

throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ public function match($rawPathinfo)
return $ret;
}

if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}

throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function match($rawPathinfo)
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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public function match($rawPathinfo)

}

if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}

throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ public function match($rawPathinfo)

}

if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}

throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ public function match($rawPathinfo)

}

if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}

throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ public function match($rawPathinfo)

}

if ('/' === $pathinfo) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}

throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}