Skip to content

Commit

Permalink
BUGFIX Type checking in CMS URL params (fixes #7187)
Browse files Browse the repository at this point in the history
Nasty issue where nested requests to sub-controllers within LeftAndMain->EditForm() would fail because of
LeftAndMain->currentPageID() being taken from the URL, even though it was a field action name.
Example: POST /admin/pages/edit/EditForm/field/MyGridField/item/1/ItemEditForm/field/MyUploadField/upload
The current ID would be detected as "field" in this case.
Bug was previously fixed for AssetAdmin.
  • Loading branch information
chillu committed Jun 22, 2012
1 parent 3e7bf77 commit ba9c3c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion admin/code/LeftAndMain.php
Expand Up @@ -1170,7 +1170,7 @@ function getSilverStripeNavigator() {
* @return int
*/
public function currentPageID() {
if($this->request->requestVar('ID')) {
if($this->request->requestVar('ID') && is_numeric($this->request->requestVar('ID'))) {
return $this->request->requestVar('ID');
} elseif (isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID'])) {
return $this->urlParams['ID'];
Expand Down

0 comments on commit ba9c3c7

Please sign in to comment.