瀏覽代碼

[HttpFoundation] Ensure response body is string, fixes #1378

Jordi Boggiano 14 年之前
父節點
當前提交
8126fb7082
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/Symfony/Component/HttpFoundation/Response.php

+ 3 - 0
src/Symfony/Component/HttpFoundation/Response.php

@@ -165,6 +165,9 @@ class Response
      */
     public function setContent($content)
     {
+        if (!is_string($content)) {
+            throw new \UnexpectedValueException('The Response content must be a string, "'.gettype($content).'" given.');
+        }
         $this->content = $content;
     }