[HttpFoundation] fixed PHP warnings

This commit is contained in:
Fabien Potencier 2013-12-31 17:19:37 +01:00
parent 410d39963b
commit cf71e226b8

View File

@ -91,7 +91,7 @@ class JsonResponse extends Response
public function setData($data = array())
{
// Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
$this->data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
$this->data = @json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException($this->transformJsonError());