Bug #14836 [HttpFoundation] Moves default JSON encoding assignment from constructor to property

This commit is contained in:
Brian Graham 2015-06-09 08:38:12 -04:00 committed by Fabien Potencier
parent f0045deaba
commit 25e0d630b8

View File

@ -26,7 +26,10 @@ class JsonResponse extends Response
{ {
protected $data; protected $data;
protected $callback; protected $callback;
protected $encodingOptions;
// Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
// 15 === JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT
protected $encodingOptions = 15;
/** /**
* Constructor. * Constructor.
@ -43,9 +46,6 @@ class JsonResponse extends Response
$data = new \ArrayObject(); $data = new \ArrayObject();
} }
// Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
$this->encodingOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT;
$this->setData($data); $this->setData($data);
} }