Skip to content
This repository
Browse code

BUGFIX Type checking in CMS URL params (fixes #7187)

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...
commit ba9c3c7b8e7c8f62e319d3cdb5cc4490b7a62f3b 1 parent 3e7bf77
Ingo Schommer authored June 22, 2012

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  admin/code/LeftAndMain.php
2  admin/code/LeftAndMain.php
@@ -1170,7 +1170,7 @@ function getSilverStripeNavigator() {
1170 1170
 	 * @return int 
1171 1171
 	 */
1172 1172
 	public function currentPageID() {
1173  
-		if($this->request->requestVar('ID'))	{
  1173
+		if($this->request->requestVar('ID') && is_numeric($this->request->requestVar('ID')))	{
1174 1174
 			return $this->request->requestVar('ID');
1175 1175
 		} elseif (isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID'])) {
1176 1176
 			return $this->urlParams['ID'];

0 notes on commit ba9c3c7

Please sign in to comment.
Something went wrong with that request. Please try again.