-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] Allow comments after tab #15747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Yaml 1.2 space white space is space or tab
In Yaml 1.2 spec white space is space or tab
…into YamlCommentsAfterTab
…into YamlCommentsAfterTab
@@ -209,7 +209,8 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter | |||
$i += strlen($output); | |||
|
|||
// remove comments | |||
if (false !== $strpos = strpos($output, ' #')) { | |||
if ((false !== $strpos = strpos($output, '#')) && | |||
($output[$strpos-1] == ' ' || $output[$strpos-1] == "\t")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be on one line
…into YamlCommentsAfterTab
@fabpot Fixed the code style. |
@@ -209,7 +209,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter | |||
$i += strlen($output); | |||
|
|||
// remove comments | |||
if (false !== $strpos = strpos($output, ' #')) { | |||
if ((false !== $strpos = strpos($output, '#')) && ($output[$strpos - 1] == ' ' || $output[$strpos - 1] == "\t")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have to use ===
and the yoda style (' ' === $output[$strpos - 1]
)
@superdav42 Can you also rebase (instead of merge) to get rid of the merge commits? |
Can you also paste the part of the YAML configuration that talks about this? Thanks. |
Yaml 1.2 space white space is space or tab
…into YamlCommentsAfterTab
@superdav42 you just need to force the push to your feature branch (as explained in our documentation btw). For branches used for PRs, it is fine |
…perdav42) This PR was merged into the 2.3 branch. Discussion ---------- [Yaml] Allow tabs before comments at the end of a line | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT If a yml file has a tab character before a line ending comment the comment will be included in the parsed value. Yaml spec allows tab or space as whitespace characters so we need to check for tab as well. See included test. Recently caused an odd and hard to find bug in our project. See spec: http://www.yaml.org/spec/1.2/spec.html#s-b-comment http://www.yaml.org/spec/1.2/spec.html#s-separate-in-line http://www.yaml.org/spec/1.2/spec.html#s-white This is a new PR replacing #15747 @fabpot Commits ------- d040be7 [Yaml] Allow tabs before comments at the end of a line
…perdav42) This PR was merged into the 2.3 branch. Discussion ---------- [Yaml] Allow tabs before comments at the end of a line | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT If a yml file has a tab character before a line ending comment the comment will be included in the parsed value. Yaml spec allows tab or space as whitespace characters so we need to check for tab as well. See included test. Recently caused an odd and hard to find bug in our project. See spec: http://www.yaml.org/spec/1.2/spec.html#s-b-comment http://www.yaml.org/spec/1.2/spec.html#s-separate-in-line http://www.yaml.org/spec/1.2/spec.html#s-white This is a new PR replacing symfony/symfony#15747 @fabpot Commits ------- d040be7 [Yaml] Allow tabs before comments at the end of a line
…perdav42) This PR was merged into the 2.3 branch. Discussion ---------- [Yaml] Allow tabs before comments at the end of a line | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT If a yml file has a tab character before a line ending comment the comment will be included in the parsed value. Yaml spec allows tab or space as whitespace characters so we need to check for tab as well. See included test. Recently caused an odd and hard to find bug in our project. See spec: http://www.yaml.org/spec/1.2/spec.html#s-b-comment http://www.yaml.org/spec/1.2/spec.html#s-separate-in-line http://www.yaml.org/spec/1.2/spec.html#s-white This is a new PR replacing symfony/symfony#15747 @fabpot Commits ------- d040be7 [Yaml] Allow tabs before comments at the end of a line
If a yml file has a tab character before a line ending comment the comment will be included in the parsed value. Yaml spec allows tab or space as whitespace characters so we need to check for tab as well. See included test.
Recently caused an odd and hard to find bug in our project.