Bug #44185
XML body always need a root node
Status:
New
Priority:
Should have
Assignee:
-
Category:
MVC
Target version:
Start date:
2012-12-21
Due date:
% Done:
0%
Estimated time:
PHP Version:
Has patch:
No
Complexity:
Description
If the request contains xml and the Content-Type header is set to "*/xml" the client currently has to surround the XML with an additional root node (which is basically ignored):
curl -i -H "Accept: application/xml" -H "Content-Type: application/xml" -X POST -d "<anything><product><title>foo</title></product></anything>" http://localhost/products
Instead the root node should be omitted:
curl -i -H "Accept: application/xml" -H "Content-Type: application/xml" -X POST -d "<product><title>foo</title></product>" http://localhost/products
This could be achieved by replacing
$xmlElement = new \SimpleXMLElement(urldecode($body), LIBXML_NOERROR);
with
$xmlElement = new \SimpleXMLElement('<root>' . urldecode($body) . '</root>', LIBXML_NOERROR);
in Http\Request::decodeBodyArguments().