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

[Form] forward valid numeric values to transform() #30126

Merged
merged 1 commit into from Feb 13, 2019

Conversation

@xabbuh
Copy link
Member

xabbuh commented Feb 9, 2019

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #30114
License MIT
Doc PR

@xabbuh xabbuh added this to the 3.4 milestone Feb 9, 2019

@xabbuh xabbuh force-pushed the xabbuh:issue-30114 branch from 139e0f5 to 4d9b63c Feb 9, 2019

@xabbuh

This comment has been minimized.

Copy link
Member Author

xabbuh commented Feb 9, 2019

@Rubinum @dbrumann @syastrebov I could need your feedback here as you all have been involved in #24036 and #26781.

@@ -58,7 +64,7 @@ public function transform($value)
if (!is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric.');
}
$value = (string) ($value / $this->divisor);
$value /= $this->divisor;

This comment has been minimized.

@dbrumann

dbrumann Feb 9, 2019

Contributor

I have tried forcing a rounding issue with and without casting to string and also by reverse transforming either value and I can't find any differences in the behavior. I can't remember why we put the string cast there, but I assume it was just for safety. This change looks good to me.

This comment has been minimized.

@syastrebov

syastrebov Feb 12, 2019

Contributor

@xabbuh checked the referenced issue and this fix, looks good to me, yes, doesn't seem casting to string was added on specific purpose here, so i think it should be fine.

@xabbuh xabbuh force-pushed the xabbuh:issue-30114 branch 2 times, most recently from be61bff to c46cee5 Feb 9, 2019

@xabbuh xabbuh force-pushed the xabbuh:issue-30114 branch from c46cee5 to 1c419a2 Feb 9, 2019

@xabbuh xabbuh force-pushed the xabbuh:issue-30114 branch from 1c419a2 to 3be0d35 Feb 9, 2019

@fabpot

fabpot approved these changes Feb 13, 2019

@fabpot

This comment has been minimized.

Copy link
Member

fabpot commented Feb 13, 2019

Thank you @xabbuh.

@fabpot fabpot merged commit 3be0d35 into symfony:3.4 Feb 13, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Feb 13, 2019

feature #30126 [Form] forward valid numeric values to transform() (xa…
…bbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] forward valid numeric values to transform()

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30114
| License       | MIT
| Doc PR        |

Commits
-------

3be0d35 forward valid numeric values to transform()

@xabbuh xabbuh deleted the xabbuh:issue-30114 branch Feb 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment