We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7b5a477 + 6577ca1 commit b618b82Copy full SHA for b618b82
vendor/php-parser/parser.php
@@ -13,8 +13,13 @@
13
14
$serializer = new PhpParser\Serializer\JSON;
15
$nodes = $serializer->serialize($stmts);
16
- echo json_encode($nodes);
17
-
+ $json = json_encode($nodes);
+ if (false === $json) {
18
+ fwrite(STDERR, "Parse Error: JSON encoding failed: ".json_last_error_msg()."\n");
19
+ exit(1);
20
+ } else {
21
+ echo $json;
22
+ }
23
} catch (PHPParser\Error $e) {
24
fwrite(STDERR, "Parse Error: ".$e->getMessage()."\n");
25
exit(1);
0 commit comments