Commit 543df477 authored by Ad Schellevis's avatar Ad Schellevis

api, missing check for existing method.

parent b7f438d5
...@@ -132,6 +132,8 @@ class ApiControllerBase extends ControllerRoot ...@@ -132,6 +132,8 @@ class ApiControllerBase extends ControllerRoot
$dispatchError = null; $dispatchError = null;
// check number of parameters using reflection // check number of parameters using reflection
$object_info = new \ReflectionObject($this); $object_info = new \ReflectionObject($this);
if ($object_info->hasMethod($callMethodName)) {
// only inspect parameters if object exists
$req_c = $object_info->getMethod($callMethodName)->getNumberOfRequiredParameters(); $req_c = $object_info->getMethod($callMethodName)->getNumberOfRequiredParameters();
if ($req_c > count($dispatcher->getParams())) { if ($req_c > count($dispatcher->getParams())) {
$dispatchError = 'action ' . $dispatcher->getActionName() . $dispatchError = 'action ' . $dispatcher->getActionName() .
...@@ -151,6 +153,7 @@ class ApiControllerBase extends ControllerRoot ...@@ -151,6 +153,7 @@ class ApiControllerBase extends ControllerRoot
$this->response->send(); $this->response->send();
return false; return false;
} }
}
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment