Explorar o código

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

Jordi Boggiano %!s(int64=14) %!d(string=hai) anos
pai
achega
8126fb7082
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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;
     }