Skip to content
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

invalid Exception #11876

Closed
1 of 3 tasks
saeideng opened this issue Mar 28, 2018 · 1 comment
Closed
1 of 3 tasks

invalid Exception #11876

saeideng opened this issue Mar 28, 2018 · 1 comment
Assignees
Milestone

Comments

@saeideng
Copy link
Member

saeideng commented Mar 28, 2018

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 3.5x , 3.6.x

    $routes->connect('/', ['controller' => 'Pages', 'action' => 'index'],
                      ['_name'=>'index']);
   $routes->connect('/home', ['controller' => 'Pages', 'action' => 'home'],
                      ['_name'=>'home','routeClass' => 'NotExistingRoute']);

and try to 'http://sitename/`
you now receive

 Duplicate Named Route 

Error: A route named "index" has already been connected to "/". 
Template Defaults Options
/ [ 'controller' => 'Pages', 'action' => 'index', 'plugin' => null ] [ '_name' => 'index', '_ext' => [], 'routeClass' => 'Cake\Routing\Route\DashedRoute' ]

//
NotExistingRoute does not exist

@saeideng saeideng added this to the 3.5.15 milestone Mar 28, 2018
@markstory markstory self-assigned this Mar 28, 2018
markstory added a commit that referenced this issue Mar 29, 2018
Previously if an application's routes used a route class that didn't
exist, Router::$initialized would not be set, so the error page
rendering would re-load the routes, and if the routes defined *before*
the missing route class were also named routes, a duplicate route error
would be displayed instead of the original error.

By inititalizing Router we avoid that issue.

Refs #11876
markstory added a commit that referenced this issue Mar 29, 2018
Previously if an application's routes used a route class that didn't
exist, Router::$initialized would not be set, so the error page
rendering would re-load the routes, and if the routes defined *before*
the missing route class were also named routes, a duplicate route error
would be displayed instead of the original error.

By initializing Router we avoid that issue.

Refs #11876
@markstory
Copy link
Member

Pull request open now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants