Skip to content

Commit

Permalink
BUGFIX: Return a 404, not a 500, if an invalid action is asked for on…
Browse files Browse the repository at this point in the history
… a RequestHandler.
  • Loading branch information
Sam Minnee committed Mar 19, 2012
1 parent 067204d commit a2c1858
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion control/RequestHandler.php
Expand Up @@ -162,12 +162,15 @@ function handleRequest(SS_HTTPRequest $request, DataModel $model) {
}

try {
if(!$this->hasMethod($action)) {
return $this->httpError(404, "Action '$action' isn't available on class " . get_class($this) . ".");
}
$result = $this->$action($request);
} catch(SS_HTTPResponse_Exception $responseException) {
$result = $responseException->getResponse();
}
} else {
return $this->httpError(403, "Action '$action' isn't allowed on class $this->class");
return $this->httpError(403, "Action '$action' isn't allowed on class " . get_class($this) . ".");
}

if($result instanceof SS_HTTPResponse && $result->isError()) {
Expand Down

0 comments on commit a2c1858

Please sign in to comment.