8000 Catch exceptions to restore the error handler · symfony/symfony@d952f90 · GitHub
[go: up one dir, main page]

Skip to content

Commit d952f90

Browse files
GromNaNfabpot
authored andcommitted
Catch exceptions to restore the error handler
1 parent ddf95c7 commit d952f90

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Symfony/Component/HttpFoundation/JsonResponse.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,15 @@ public function setData($data = array())
106106
}
107107
});
108108

109-
$this->data = json_encode($data, $this->encodingOptions);
109+
try {
110+
$this->data = json_encode($data, $this->encodingOptions);
110111

111-
restore_error_handler();
112+
restore_error_handler();
113+
} catch (\Exception $exception) {
114+
restore_error_handler();
115+
116+
throw $exception;
117+
}
112118

113119
if (JSON_ERROR_NONE !== json_last_error()) {
114120
throw new \InvalidArgumentException($this->transformJsonError());

0 commit comments

Comments
 (0)
0