minor #17346 [2.3] Workaround https://bugs.php.net/63206 (nicolas-grekas)

This PR was merged into the 2.3 branch.

Discussion
----------

[2.3] Workaround https://bugs.php.net/63206

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This bug has almost no chance to be hit in this code but still, cleaning any potential issue is worth.

Commits
-------

c5479dd [2.3] Workaround https://bugs.php.net/63206
This commit is contained in:
Fabien Potencier 2016-01-13 08:40:10 +01:00
commit 7a02f4e43e
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ class JsonResponse extends Response
// PHP 5.3 triggers annoying warnings for some
// types that can't be serialized as JSON (INF, resources, etc.)
// but doesn't provide the JsonSerializable interface.
set_error_handler('var_dump', 0);
set_error_handler(function () { return false; });
$data = @json_encode($data, $this->encodingOptions);
} else {
// PHP 5.4 and up wrap exceptions thrown by JsonSerializable