Skip to content
This repository
Browse code

BUGFIX: Return a 404, not a 500, if an invalid action is asked for on…

… a RequestHandler.
  • Loading branch information...
commit a2c185889229e34569e7cdfae39e0d4e5923119d 1 parent 067204d
Sam Minnée authored March 19, 2012

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

  1. 5  control/RequestHandler.php
5  control/RequestHandler.php
@@ -162,12 +162,15 @@ function handleRequest(SS_HTTPRequest $request, DataModel $model) {
162 162
 						}
163 163
 						
164 164
 						try {
  165
+							if(!$this->hasMethod($action)) {
  166
+								return $this->httpError(404, "Action '$action' isn't available on class " . get_class($this) . ".");
  167
+							}
165 168
 							$result = $this->$action($request);
166 169
 						} catch(SS_HTTPResponse_Exception $responseException) {
167 170
 							$result = $responseException->getResponse();
168 171
 						}
169 172
 					} else {
170  
-						return $this->httpError(403, "Action '$action' isn't allowed on class $this->class");
  173
+						return $this->httpError(403, "Action '$action' isn't allowed on class " . get_class($this) . ".");
171 174
 					}
172 175
 				
173 176
 					if($result instanceof SS_HTTPResponse && $result->isError()) {

0 notes on commit a2c1858

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