Skip to content

[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

Merged
merged 1 commit into from
Jul 3, 2017
Merged

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jun 24, 2017

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.

@xabbuh xabbuh force-pushed the yaml-str-tag-deprecation branch 2 times, most recently from 55c34cb to a6b5571 Compare June 25, 2017 06:03
The tag specified in the YAML spec is actually !!str.
@xabbuh xabbuh force-pushed the yaml-str-tag-deprecation branch from a6b5571 to 976b93a Compare June 25, 2017 06:10
return (string) substr($scalar, 5);
case 0 === strpos($scalar, '!!str '):
return (string) substr($scalar, 6);
Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fine for me :)

Copy link
Member

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)

Copy link
Contributor

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 :)

@fabpot
Copy link
Member

fabpot commented Jul 3, 2017

Thank you @xabbuh.

@fabpot fabpot merged commit 976b93a into symfony:3.4 Jul 3, 2017
fabpot added a commit that referenced this pull request Jul 3, 2017
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
@xabbuh xabbuh deleted the yaml-str-tag-deprecation branch July 3, 2017 11:09
This was referenced Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants