Skip to content

Commit 4b9425b

Browse files
committed
bug #19922 [Yaml][TwigBridge] Use JSON_UNESCAPED_SLASHES for lint commands output (chalasr)
This PR was merged into the 2.7 branch. Discussion ---------- [Yaml][TwigBridge] Use JSON_UNESCAPED_SLASHES for lint commands output | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Slashes are escaped when sing the `lint:twig` and `lint:yaml` commands with the `format` option set to `json`, giving such results: ```json [ { "file": "yaml\/wrong\/1.yml", "valid": false, "message": "Unable to parse at line 1 (near \";:cc`\")." } ] ``` That's not convenient as file paths may be reused (e.g. copy-pasted). Results stay fine as error messages are already escaped: ```json [ { "file": "yaml/wrong/1.yml", "valid": false, "message": "Unable to parse at line 1 (near \";:cc`\")." } ] ``` Commits ------- 0427594 Use JSON_UNESCAPED_SLASHES for lint commands output
2 parents 54430f4 + 1acb110 commit 4b9425b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Command/YamlLintCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private function displayJson(OutputInterface $output, $filesInfo)
156156
}
157157
});
158158

159-
$output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0));
159+
$output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES : 0));
160160

161161
return min($errors, 1);
162162
}

0 commit comments

Comments
 (0)