[HttpFoundation] Make JsonResponse HTML safe.

This commit is contained in:
Niklas Fiekas 2012-06-07 16:36:16 +02:00
parent 1541fe26e4
commit 5c2fbfabf6

View File

@ -82,7 +82,8 @@ class JsonResponse extends Response
$data = new \ArrayObject();
}
$this->data = json_encode($data);
// 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);
return $this->update();
}