{"action":"opened","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/8947","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/8947/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/8947/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/8947/events","html_url":"https://github.com/cakephp/cakephp/issues/8947","id":158669909,"number":8947,"title":"Nested \"restful\"-route doesn't work when adding an extension like .json","user":{"login":"Spriz","id":3512268,"avatar_url":"https://avatars.githubusercontent.com/u/3512268?v=3","gravatar_id":"","url":"https://api.github.com/users/Spriz","html_url":"https://github.com/Spriz","followers_url":"https://api.github.com/users/Spriz/followers","following_url":"https://api.github.com/users/Spriz/following{/other_user}","gists_url":"https://api.github.com/users/Spriz/gists{/gist_id}","starred_url":"https://api.github.com/users/Spriz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spriz/subscriptions","organizations_url":"https://api.github.com/users/Spriz/orgs","repos_url":"https://api.github.com/users/Spriz/repos","events_url":"https://api.github.com/users/Spriz/events{/privacy}","received_events_url":"https://api.github.com/users/Spriz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-06T12:51:47Z","updated_at":"2016-06-06T12:51:47Z","closed_at":null,"body":"This is a (multiple allowed):\r\n* [x] bug\r\n* [ ] enhancement\r\n* [ ] feature-discussion (RFC)\r\n\r\n* CakePHP Version: 3.2.10\r\n* Platform and Target: 5.6.21-9+donate.sury.org~trusty+1 and simple chrome/postman/firefox HTTP get\r\n\r\n### What you did\r\nAdded following nested \"restful\"-url to routing.php: https://gist.github.com/Spriz/df18b6f411271970738dbda5277f042f#file-routes-php-L5\r\n\r\n### Expected Behaviour\r\nthat /api/items/:item_id/variants would work with `$this->request->params('item_id')` in the `VariantsController` (like the book explains)\r\n\r\n### Actual Behaviour\r\nWithout `.json` extension, it works - but when adding a `.json` extension, I get this error: https://gist.github.com/Spriz/df18b6f411271970738dbda5277f042f#file-response-json-L4\r\n(it's looking for an action with the id rather than using the routes)\r\n\r\nIf I `var_dump()` the `$route` variable here: https://github.com/cakephp/cakephp/blob/master/src/Routing/Route/Route.php#L276 it's already \"wrong\": \r\n```\r\n[\r\n\t(int) 0 => '/api/items/000443c8-cd07-35a9-a3f1-74b61ac8f233/variants',\r\n\t'controller' => 'items',\r\n\t(int) 1 => 'items',\r\n\t'action' => '000443c8-cd07-35a9-a3f1-74b61ac8f233',\r\n\t(int) 2 => '000443c8-cd07-35a9-a3f1-74b61ac8f233',\r\n\t'_args_' => 'variants',\r\n\t(int) 3 => 'variants'\r\n]\r\n```\r\n\r\nI figured it should be somewhere before this it's going wrong.\r\n\r\nIt's matching the following route: \r\n`'#^/api/(?:(?P<controller>[^/]+))/(?:(?P<action>[^/]+))(?:/(?P<_args_>.*))?[/]*$#'`\r\n\r\ninstead of one of the previous ones: `'#^/api/items/(?:(?P<item_id>[^/]+))/variants[/]*$#'`"}}
{"actor":{"display_login":"Spriz"}}