merged branch esgy/patch-1 (PR #8420)

This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #8420).

Discussion
----------

Update JsonResponse.php

Added JSON_NUMERIC_CHECK flag to fix issues when json response is used in JavaScript apps and especially in AngularJS.

Commits
-------

2b1c973 Update JsonResponse.php
This commit is contained in:
Fabien Potencier 2013-07-08 15:12:22 +02:00
commit af31180205
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,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 | JSON_NUMERIC_CHECK);
return $this->update();
}