Skip to content

[YAML] Underscores are removed from strings treating them as integers. #27120

@kobelobster

Description

@kobelobster
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4.

Hello, I've created a YAML file where the value 6000_5000 was stored. This YAML was simply created for populating database tables with data for test cases. When I wrote the test case, I searched for data containing 6000_5000 but had no results. After some research, I saw, that 6000_5000 was saved as 60005000, so I digged deep to see why that happens.

I found this line (including blame) and this PR where it states

Allows to use the _ to group "big" ints, as suggested in the yaml integer type specification. As discussed in #18094, we should check if it is still part of the 1.2 specification, but I don't really see why not?

Okay, so I searched a bit and found this type definition where it states exactly what the PR should do, however this is, as the PR, for YAML version 1.1, so I opened the int specs for 1.2 which you can find here

In this definition, there is no mentioning of using _ as readability help, and I didn't find this recommendation anywhere else, so in order to comply with 1.2 standards of the YAML definition, I'd say Symfony needs to remove this.

Now I don't know how to handle this correctly. I'd open a PR, but this is a BC break, so it's not possible to merge this into the 4.x branch, but this violates the YAML definition, so a user, who reads version 1.2 of the YAML definition and uses Symfony will have NO idea WHY this happens.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions