Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Yaml] deprecate comma separators in floats#18785

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromxabbuh:issue-18178
May 24, 2016

Conversation

@xabbuh
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#18178
LicenseMIT
Doc PR

case0 ===strpos($scalar,'!!binary'):
returnself::evaluateBinaryScalar(substr($scalar,9));
casepreg_match('/^(-|\+)?[0-9][0-9,]*(\.[0-9_]+)?$/',$scalar):
@trigger_error('Using the comma as a group separator for floats is deprecated since version 3.2 and will be removed in 4.0.',E_USER_DEPRECATED);

Choose a reason for hiding this comment

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

If I understand this regexp right, the deprecation error will be triggered for example for numbers like123.45 but it shouldn't. We'd need to test explicitly the presence of the comma.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, the order of regexps should be changed, to match the standard regex first to handle the case of values matching the spec
This will require to duplicate the linereturn (float) str_replace(array(',', '_'), '', $scalar); instead of using a fallthrough, but this is not an issue.

Copy link
MemberAuthor

@xabbuhxabbuhMay 17, 2016
edited
Loading

Choose a reason for hiding this comment

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

These cases are already handled further up where we have theis_numeric() check (and we have tests covering that this is working).

Copy link
Contributor

Choose a reason for hiding this comment

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

As@javiereguiluz said, this deprecation will be triggered with123.45, which is not correct. IMO, the* should be replaced with a+ to ensure that a, is indeed used.

Copy link
Contributor

Choose a reason for hiding this comment

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

actually, the+ won't be enough ; we need to test that[0-9]+,[0-9]*(?:\.[0-9_]+)? matches this I think (but I'm not too sure too)

Choose a reason for hiding this comment

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

@Taluu but it's true what@xabbuh said: this is handled in the code above thiscase: and there are tests about this and they pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

But it should be triggered for123.45_67 though (I think), as there are no cases for that above this case, and that is valid though. And I think a_ may have been forgotten in the part before the. actually.

IMO, we should do astrpos test to test that a, is indeed in the match, and then only trigger the deprecation

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@Taluu You are right. I opened#18858 which should fix this issue.

And I think a_ may have been forgotten in the part before the. actually.

I think it's okay the way it is. We only introduced the_ for 3.2 and I think people should not start mixing_ and, then. If they want to use_, they should just move away from, as well.

Taluu reacted with thumbs up emoji
@javiereguiluz
Copy link
Member

👍

Status: reviewed

@fabpot
Copy link
Member

Thank you@xabbuh.

@fabpotfabpot merged commit3f3623d intosymfony:masterMay 24, 2016
fabpot added a commit that referenced this pull requestMay 24, 2016
This PR was merged into the 3.2-dev branch.Discussion----------[Yaml] deprecate comma separators in floats| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#18178| License       | MIT| Doc PR        |Commits-------3f3623d [Yaml] deprecate comma separators in floats
@xabbuhxabbuh deleted the issue-18178 branchMay 24, 2016 10:35
@fabpotfabpot mentioned this pull requestOct 27, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@xabbuh@javiereguiluz@fabpot@Taluu@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp