-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Routing issue with installation in a sub-directory #7129
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
Comments
It's a problem of the loader in SonataAdminBundle and should be reported there. Thanks. |
@Tobion This issue is not related to the AdminBundle. The parameter provided in the routing file is not translated to the correct value. |
@Tobion the resolve parameter does not seems to replace the |
Prefix is just the prefix of the path. So it is part of the path in the end. |
I think the problem is not with the route pattern ($pathinfo) itself but with the pattern it is tested against in But I don't know how that string is created. |
I found a workaraound: in namespace Symfony\Component\Routing\Matcher\Dumper change line 141 from $optimizable = '' !== $prefix && $prefix !== $parentPrefix && $countDirectChildRoutes > 0 && $countAllChildRoutes > 1 && false === strpos($prefix, '{'); to $optimizable = false;//'' !== $prefix && $prefix !== $parentPrefix && $countDirectChildRoutes > 0 && $countAllChildRoutes > 1 && false === strpos($prefix, '{'); and it works. |
ok, here's a possible patch: first we need a setter for the RouteCollection prefix in Symfony\Component\Routing\RouteCollection like:
Then in Symfony\Bundle\FrameworkBundle\Routing\Router add this line: $collection->setPrefix('/'.ltrim($this->resolveString($collection->getPrefix()), '/')); in function ResolveParameters like
|
@Tobion Can you reconsidere this issue ? Thanks |
I see this is for Symfony 2.1 only. It should be fixed in 2.2 |
@Tobion yes, will need a couple of days. |
* 2.1: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129 Conflicts: .travis.yml src/Symfony/Bundle/FrameworkBundle/Routing/Router.php src/Symfony/Component/Routing/RouteCollection.php
* 2.2: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129
This PR was merged into the 2.1 branch. Discussion ---------- Routing issue with installation in a sub-directory ref: symfony#7129 Commits ------- 8d9cd42 Routing issue with installation in a sub-directory ref: symfony#7129
* 2.1: symfony#7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes symfony#7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR symfony#7378)" Routing issue with installation in a sub-directory ref: symfony#7129 Conflicts: .travis.yml src/Symfony/Bundle/FrameworkBundle/Routing/Router.php src/Symfony/Component/Routing/RouteCollection.php
* 2.2: symfony#7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes symfony#7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR symfony#7378)" Routing issue with installation in a sub-directory ref: symfony#7129
* 2.1: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129 Conflicts: .travis.yml src/Symfony/Bundle/FrameworkBundle/Routing/Router.php src/Symfony/Component/Routing/RouteCollection.php
* 2.2: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129
* 2.1: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129 Conflicts: .travis.yml src/Symfony/Bundle/FrameworkBundle/Routing/Router.php src/Symfony/Component/Routing/RouteCollection.php
* 2.2: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129
This PR was merged into the 2.1 branch. Discussion ---------- Routing issue with installation in a sub-directory ref: symfony/symfony#7129 Commits ------- 8d9cd42 Routing issue with installation in a sub-directory ref: symfony/symfony#7129
* 2.1: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129 Conflicts: .travis.yml src/Symfony/Bundle/FrameworkBundle/Routing/Router.php src/Symfony/Component/Routing/RouteCollection.php
* 2.2: #7106 - fix for ZTS builds Added '@@' escaping strategy for YamlFileLoader and YamlDumper [Yaml] fixed bugs with folded scalar parsing [Form] made DefaultCsrfProvider using session_status() when available Added unit tests to Dumper Update .travis.yml (closes #7355) [HttpFoudantion] fixed Request::getPreferredLanguage() Revert "merged branch jfsimon/issue-6928 (PR #7378)" Routing issue with installation in a sub-directory ref: symfony/symfony#7129
Symfony 2.1:
In parameters.yml I have
sub_dir: /mnc
In config.yml:
sonata:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: %sub_dir%/secured/admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /mnc/secured/admin
Up to here everything works fine, but if I use
sonata:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: %sub_dir%/secured/admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: %sub_dir%/secured/admin
I get a route not found error.
I checked that in the latter case the line
is generated in the cache file appdevUrlMatcher.php, which should in fact be
Regards
The text was updated successfully, but these errors were encountered: