Skip to content

Commit 31c073b

Browse files
[HttpFoundation] work around PHP 7.3 bug related to json_encode()
1 parent 6e2e2de commit 31c073b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Console/Descriptor/JsonDescriptor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ protected function describeContainerParameter($parameter, array $options = [])
185185
private function writeData(array $data, array $options)
186186
{
187187
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
188+
189+
if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $flags)) {
190+
// Work around https://bugs.php.net/77997
191+
json_encode(null);
192+
}
193+
188194
$this->write(json_encode($data, $flags | JSON_PRETTY_PRINT)."\n");
189195
}
190196

0 commit comments

Comments
 (0)