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

Lang/En: Ordinal function: int === float, Fixes #2549 #2550

Closed
wants to merge 1 commit into from

Conversation

levu42
Copy link

@levu42 levu42 commented Feb 17, 2022

Compare float to float, not float to int

Fix #2549

Compare float to float, not float to int
Copy link
Collaborator

@kylekatarnls kylekatarnls left a comment

Choose a reason for hiding this comment

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

Thanks for the report and the work on it🙏

As per tests we now have: '11st' which is not correct, we should have '11th'.

For a proper fix for this it would need:

  • a unit test to show the case we fix (so we can ensure it does not regress and we see how the "Implicit conversion" error can be triggered and be sure the fix actually avoid this error to occur)
  • fix all languages using the same principle ~~ or % a / b, I think it's only used for selecting numbers from 10 to 19 (maybe this can be done is a more explicit way)
  • keep compatibility from PHP 7.1.8

Would you be possible for you to update this pull-requests with those items?

@levu42 levu42 marked this pull request as draft February 18, 2022 10:34
@levu42
Copy link
Author

levu42 commented Feb 18, 2022

@kylekatarnls Thanks for your feedback! I'll work on fixing all the mentioned points in the next days!

@kylekatarnls
Copy link
Collaborator

Deprecations are now converted into exception in the unit tests so they will be detected by the build. Then those int cast are now fixed, you can try composer require "nesbot/carbon:dev-master as 2.58.0" if you want to test the next version.

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.

PHP 8.1 Implicit conversion from float to int loses precision
2 participants