Skip to content
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

[6.x] Correct implementation of float casting comparison #33322

Merged
merged 1 commit into from
Jun 30, 2020

Conversation

GrahamCampbell
Copy link
Member

No description provided.

@GrahamCampbell GrahamCampbell marked this pull request as ready for review June 24, 2020 13:53
@GrahamCampbell
Copy link
Member Author

// cc @CraigHarley

Copy link
Contributor

@CraigHarley CraigHarley left a comment

Choose a reason for hiding this comment

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

Looks good to me, and doesn't mean a dependency on ext-bcmath 🚀

@taylorotwell taylorotwell merged commit 90892f9 into 6.x Jun 30, 2020
@driesvints driesvints deleted the float-cast-fix branch June 30, 2020 13:24
@Quintile
Copy link

Quintile commented Jul 2, 2020

With this change, if you have a decimal column set to null, and try to update it to 0.0, it will fail to update because originalIsEquivalent will return true, because 0.0 - null = 0.0 and 0.0 is < PHP_FLOAT_EPSILON * 4.

So it's currently impossible to update a null column to a 0.0 value.

@Quintile
Copy link

Quintile commented Jul 3, 2020

I believe the $attribute is checked as null, not the $original. In this scenario $attribute is 0.0 and $original is null. It won't update in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants