{"action":"opened","issue":{"url":"https://api.github.com/repos/slimphp/Slim/issues/1637","labels_url":"https://api.github.com/repos/slimphp/Slim/issues/1637/labels{/name}","comments_url":"https://api.github.com/repos/slimphp/Slim/issues/1637/comments","events_url":"https://api.github.com/repos/slimphp/Slim/issues/1637/events","html_url":"https://github.com/slimphp/Slim/issues/1637","id":119740403,"number":1637,"title":"Slim3: XML _METHOD override throws InvalidArgumentException","user":{"login":"rbairwell","id":775269,"avatar_url":"https://avatars.githubusercontent.com/u/775269?v=3","gravatar_id":"","url":"https://api.github.com/users/rbairwell","html_url":"https://github.com/rbairwell","followers_url":"https://api.github.com/users/rbairwell/followers","following_url":"https://api.github.com/users/rbairwell/following{/other_user}","gists_url":"https://api.github.com/users/rbairwell/gists{/gist_id}","starred_url":"https://api.github.com/users/rbairwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbairwell/subscriptions","organizations_url":"https://api.github.com/users/rbairwell/orgs","repos_url":"https://api.github.com/users/rbairwell/repos","events_url":"https://api.github.com/users/rbairwell/events{/privacy}","received_events_url":"https://api.github.com/users/rbairwell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-01T15:27:00Z","updated_at":"2015-12-01T15:27:00Z","closed_at":null,"body":"Given the test XML:\r\n````xml\r\n<test><person><name>Josh</name></person><_METHOD>HEAD</_METHOD></test>\r\n````\r\nI would expect Slim's method override (in Slim\\Http\\Request) to change the request type from the original to \"HEAD\". However, passing that string in as the request body (with an application/xml;charset=utf8 content-type) results in an error:\r\n````\r\nInvalidArgumentException: Unsupported HTTP method; must be a string, received SimpleXMLElement\r\n\r\n/vagrant/..../vendor/slim/slim/Slim/Http/Request.php:308\r\n/vagrant/..../vendor/slim/slim/Slim/Http/Request.php:243\r\n````\r\nA \"quick fix\" for this seems to be changing \\Slim\\Http\\Request::getMethod\r\n````php\r\n$this->method = $this->filterMethod($body->_METHOD);\r\n````\r\nto\r\n````php\r\n$this->method = $this->filterMethod((string)$body->_METHOD);\r\n````\r\n\r\nI have not provided a PR as I'm not 100% confident that is how you are expecting people to override the request method in XML and I'm not confident the fix is the best solution (I dislike typecasting unless really really necessary).\r\n\r\n[PHP7, composer installed]"}}