Skip to content

Commit

Permalink
[HttpFoundation] forced Response content to be string
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 22, 2011
1 parent b2b0c4a commit 37521b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Symfony/Component/HttpFoundation/Response.php
Expand Up @@ -170,7 +170,8 @@ public function setContent($content)
if (!is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) {
throw new \UnexpectedValueException('The Response content must be a string or object implementing __toString(), "'.gettype($content).'" given.');
}
$this->content = $content;

$this->content = (string) $content;
}

/**
Expand Down
Expand Up @@ -431,7 +431,7 @@ public function testSetContent($content)
{
$response = new Response();
$response->setContent($content);
$this->assertEquals($content, $response->getContent());
$this->assertEquals((string) $content, $response->getContent());
}

/**
Expand Down

0 comments on commit 37521b6

Please sign in to comment.