diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2013-09-27 14:36:19 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2013-10-01 20:13:13 +0200 |
commit | bdad7697ac333ea442b79b5e0e00f90ad5398bc9 (patch) | |
tree | d6d409a7b296bbafb1d259da4d248b7c9dc9590d /lib/private/appframework | |
parent | 5ade595911261cf47cdad17deb4d1a013f523245 (diff) | |
download | nextcloud-server-bdad7697ac333ea442b79b5e0e00f90ad5398bc9.tar.gz nextcloud-server-bdad7697ac333ea442b79b5e0e00f90ad5398bc9.zip |
Check if accessor matched request method.
It's easier to find errors in the code if an exception is thrown.
Diffstat (limited to 'lib/private/appframework')
-rw-r--r-- | lib/private/appframework/http/request.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index 34605acdfea..5a86066b48b 100644 --- a/lib/private/appframework/http/request.php +++ b/lib/private/appframework/http/request.php @@ -152,6 +152,9 @@ class Request implements \ArrayAccess, \Countable, IRequest { switch($name) { case 'get': case 'post': + if($this->method !== strtoupper($name)) { + throw new \BadMethodCallException(sprintf('%s cannot be accessed in a %s request.', $name, $this->method)); + } case 'files': case 'server': case 'env': |