diff --git a/src/Illuminate/Http/Response.php b/src/Illuminate/Http/Response.php index f8bc37899cee..b48ea7ffcbb1 100755 --- a/src/Illuminate/Http/Response.php +++ b/src/Illuminate/Http/Response.php @@ -53,6 +53,10 @@ public function setContent($content) $this->header('Content-Type', 'application/json'); $content = $this->morphToJson($content); + + if ($content === false) { + throw new \UnexpectedValueException(sprintf('Failed to convert the provided Response content to JSON with the message: %s', json_last_error_msg())); + } } // If this content implements the "Renderable" interface then we will call the