Skip to content

Commit 6eec58d

Browse files
[HttpFoundation] work around PHP 7.3 bug related to json_encode()
1 parent 5de015a commit 6eec58d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Descriptor/JsonDescriptor.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,14 @@ protected function describeApplication(Application $application, array $options
9797
*/
9898
private function writeData(array $data, array $options)
9999
{
100-
$this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
100+
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
101+
102+
if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $flags)) {
103+
// Work around https://bugs.php.net/77997
104+
json_encode(null);
105+
}
106+
107+
$this->write(json_encode($data, $flags));
101108
}
102109

103110
/**

0 commit comments

Comments
 (0)