Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit cdea8bd

Browse files
committedNov 12, 2015
Allow non-urlencoded content as request body
1 parent c28689a commit cdea8bd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎src/Controller/AbstractRestfulController.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ protected function getIdentifier($routeMatch, $request)
560560
*
561561
* If the content-type indicates a JSON payload, the payload is immediately
562562
* decoded and the data returned. Otherwise, the data is passed to
563-
* parse_str(). If that function returns a single-member array with a key
564-
* of "0", the method assumes that we have non-urlencoded content and
563+
* parse_str(). If that function returns a single-member array with a empty
564+
* value, the method assumes that we have non-urlencoded content and
565565
* returns the raw content; otherwise, the array created is returned.
566566
*
567567
* @param mixed $request
@@ -578,10 +578,9 @@ protected function processBodyContent($request)
578578

579579
parse_str($content, $parsedParams);
580580

581-
// If parse_str fails to decode, or we have a single element with key
582-
// 0, return the raw content.
583-
if (!is_array($parsedParams)
584-
|| (1 == count($parsedParams) && isset($parsedParams[0]))
581+
// If parse_str fails to decode, or we have a single element with empty value
582+
if (!is_array($parsedParams) || empty($parsedParams)
583+
|| (1 == count($parsedParams) && '' === reset($parsedParams))
585584
) {
586585
return $content;
587586
}

0 commit comments

Comments
 (0)
This repository has been archived.