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
Display the Welcome Page when there is no homepage defined #26041
Conversation
I'm +1 on the intend. |
Definitely 👍 |
Hey Javier, I like your proposal and in the same direction we might need to make some additional changes: The phrase
According to your idea, this part should also be updated: symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php Lines 79 to 81 in ae25291
Related fixtures that require updating (files): symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php Lines 423 to 429 in ae25291
In the other hand, I have a concern now about the name/description of this exception, because it does not fit his new scenario, i.e. it'll be thrown even with routes configuration: symfony/src/Symfony/Component/Routing/Exception/NoConfigurationException.php Lines 14 to 21 in ae25291
Do you think we can add another exception NoRootConfiguration extends NoConfiguration and throw it instead? In that case we might need deprecate the NoConfiguration class or use it only when '' === $code :
$code .= " if ('/' === \$pathinfo) {\n";
if ('' === $code) {
$code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
} else {
$code .= " throw new Symfony\Component\Routing\Exception\NoRootConfigurationException();\n";
}
$code .= " }\n"; |
I think it doesn't matter much, let's keep things simple IMHO |
Status: needs work |
So is there a quick fix? |
I found this affects 4.0 too. (I just started following the getting started guide with 4.0.) But I see that this is about the 3.4 branch and the other 4.0 pull requests and issues are closed... so I am wondering if this fix will apply to 4.x too? |
@yceruto I'm sorry but I don't know how to make the changes you mentioned in |
@yceruto thanks for your great help! I made the change and tests are now green. Ready for review! |
Thank you @javiereguiluz. |
… (javiereguiluz) This PR was squashed before being merged into the 3.4 branch (closes #26041). Discussion ---------- Display the Welcome Page when there is no homepage defined | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony-docs#9178 | License | MIT | Doc PR | - In 3.4 we added a trick to display the Welcome Page when the user browses `/` and there are no routes defined. However, when using the `website-skeleton` (which is what most newcomers use ... and they are the ones that mostly need the "Welcome Page") the premise about *"no routes are defined"* is never true and the Welcome Page is never shown (see symfony/symfony-docs#9178 for one of the multiple error reports we've received). So, I propose to make this change to always define the "Welcome Page" as the fallback: * If no routes are defined for `/`, the Welcome Page is displayed. * If there is a route defined for `/`, this code will never be executed because it's the last condition of the routing matcher. Commits ------- 5b0d934 Display the Welcome Page when there is no homepage defined
Hey @javiereguiluz, will this be ported to the 4.0 branch? |
Yes. Pull requests are periodically merged from lower to upper maintained branches, so this will end up in 4.0 and master too. Here is the list of maintained branches: https://symfony.com/roadmap |
Fedora 26, Symfony 4.0., just installed (by |
@mario6097 It's already fixed, but it has not been released yet. |
I use jms/i18n-routing-bundle and update symfony to 3.4.7 and i have problem with this feature. |
Same like @idildin. composer.json
routing.yml
config.yml
My question is: should I wait to fix by JMS I18N Routing bundle or by Symfony or is there any workaround to force default language redirect? |
Please open dedicated issues instead: you won't get any attention by commenting on closed ones. |
Also, this is a BC for everyone involving in progressive migration to Symfony => https://github.com/PrestaShop/PrestaShop/blob/develop/admin-dev/index.php#L87 I can't imagine what motivated you to change the behavior in an LTS :/ Any workaround? EDIT: nevermind, it's already fixed with the latest 3.4, thanks :) |
In 3.4 we added a trick to display the Welcome Page when the user browses
/
and there are no routes defined. However, when using thewebsite-skeleton
(which is what most newcomers use ... and they are the ones that mostly need the "Welcome Page") the premise about "no routes are defined" is never true and the Welcome Page is never shown (see symfony/symfony-docs#9178 for one of the multiple error reports we've received).So, I propose to make this change to always define the "Welcome Page" as the fallback:
/
, the Welcome Page is displayed./
, this code will never be executed because it's the last condition of the routing matcher.