Open weierophinney opened 4 years ago
@autowp I've made the change a bit more generic. It does not depend now on the content-type, as it was before. In case we have one element with empty value we are checking if the last character of the content is =
. If so, then it is "correct" urlencoded content and we return array, as expected.
In case we have any string without =
it will return this string, not an array.
In general I think it should be completely changed to work properly with the given content type correctly, as now this is quite hacky, imo.
Originally posted by @michalbundyra at https://github.com/zendframework/zend-mvc/pull/251#issuecomment-562934623
Controller/AbstractRestfulController
There is no way to PUT/PATCH object with single field to empty value.
Request payload is interpreted as string (
$data = 'name=';
) regardless Content-Type. Proper value is$data = ['name' => ''];
I think ideally is split behaviour by Content-Type but that follows to huge BC. (see testCanReceiveStringAsRequestContent)
My pull request handle just one situation (example above) by header.
Originally posted by @autowp at https://github.com/zendframework/zend-mvc/pull/251