Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 946b96b

Browse filesBrowse 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 f321989 + 0427594 commit 946b96b
Copy full SHA for 946b96b

File tree

2 files changed

+2
-2
lines changed
Filter options

2 files changed

+2
-2
lines changed

‎src/Symfony/Bridge/Twig/Command/LintCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Command/LintCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private function displayJson(OutputInterface $output, $filesInfo)
202202
}
203203
});
204204

205-
$output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0));
205+
$output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT JSON_UNESCAPED_SLASHES : 0));
206206

207207
return min($errors, 1);
208208
}

‎src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.