silverstripe/sapphire — pull request #711 by tractorcow (2012-08-08 04:31:23+00:00)
Title: FIXED: Issue where route table arguments would not be accessible without using non deprecated API

This pull request is for a "fix" for a gap in the api.

Previously any arguments specified on the routing table would be saved in Director::urlParams() and could be retrieved by the controller. For example, my routes.yml file looks like the below:

```yml
---
Name: translatedroutes
After: framework/routes#rootroutes
---
Director:
rules:
'en_NZ/$URLSegment!//$Action/$ID/$OtherID':
Controller: 'ModelAsController'
Locale: 'en_NZ'
```

In 2.4 the "Locale" parameter would be available, but trying to access this in SS 3.0 via Director::urlParams() gives a deprecation error, noting that SS_HTTPRequest->latestParams() should be used instead. Since only arguments in the url pattern (URLSegment, Action, etc) are actually stored in the request object, this actually represents a degradation in functionality.

My fix is to ensure that during routing these additional parameters are correctly passed to the request object and stored, so that they may be retrieved via $this->request->latestParams().

Note: A previous pull request to fix this issue caused a test case (ContentControllerTest) to fail. This pull request resolves this issue.