diff --git a/framework/web/JsonParser.php b/framework/web/JsonParser.php index 9102316a69..8453ed0ff8 100644 --- a/framework/web/JsonParser.php +++ b/framework/web/JsonParser.php @@ -35,7 +35,7 @@ class JsonParser implements RequestParserInterface public function parse($rawBody) { try { - return Json::encode($rawBody, $this->asArray); + return Json::decode($rawBody, $this->asArray); } catch (InvalidParamException $e) { if ($this->throwException) { throw $e; diff --git a/framework/web/RequestParserInterface.php b/framework/web/RequestParserInterface.php index dfeed558f5..42e6ca412e 100644 --- a/framework/web/RequestParserInterface.php +++ b/framework/web/RequestParserInterface.php @@ -15,9 +15,9 @@ namespace yii\web; */ interface RequestParserInterface { - /** - * @param string $rawBody the raw HTTP request body - * @return array parameters parsed from the request body - */ + /** + * @param string $rawBody the raw HTTP request body + * @return array parameters parsed from the request body + */ public function parse($rawBody); }