-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] deprecate the !str tag #23288
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
55c34cb
to
a6b5571
Compare
The tag specified in the YAML spec is actually !!str.
a6b5571
to
976b93a
Compare
return (string) substr($scalar, 5); | ||
case 0 === strpos($scalar, '!!str '): | ||
return (string) substr($scalar, 6); |
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.
While doing this, can't we use parseScalar
here?
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.
Maybe it's better to do that in a separate PR to not mix too many things in the same PR.
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.
Ok, fine for me :)
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.
if we use parseScalar, we may end up parsing the value as a YAML timestamp for instance, which will break the usage of the tag (see not-date: !!str 2002-04-28
in the tests for instance)
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.
Fortunately parseScalar
has a $evaluate
argument :)
Thank you @xabbuh. |
This PR was merged into the 3.4 branch. Discussion ---------- [Yaml] deprecate the !str tag | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The tag specified in the YAML spec is actually !!str. Commits ------- 976b93a [Yaml] deprecate the !str tag
The tag specified in the YAML spec is actually !!str.