From 98ca9f1668478abd0379862db14d4559bb830e07 Mon Sep 17 00:00:00 2001 From: Richard Bone Date: Tue, 2 Apr 2013 10:15:46 -0700 Subject: [PATCH] Ensure Request::$data is always an array --- src/Mongrel2/Request.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mongrel2/Request.php b/src/Mongrel2/Request.php index 6f63c70..a04d7e2 100644 --- a/src/Mongrel2/Request.php +++ b/src/Mongrel2/Request.php @@ -20,7 +20,7 @@ public function __construct($sender, $conn_id, $path, $headers, $body) $this->body = $body; if ($this->headers->METHOD == 'JSON') { - $this->data = json_decode($body); + $this->data = json_decode($body, true); } else { $this->data = array(); } @@ -36,7 +36,7 @@ public static function parse($msg) $body = $hd[0]; $headers = json_decode($headers); - + return new Request($sender, $conn_id, $path, $headers, $body); }