Browse Source

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

Jordi Boggiano 14 năm trước cách đây
mục cha
commit
8126fb7082
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  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;
     }