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

PHP deprecation error in WP_Image_Editor crop (`Implicit conversion from float) #44

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

nicomollet
Copy link

This pull request removes the PHP deprecated errors (like Implicit conversion from float 1112.7466666666667 to int loses precision) in WP_Image_Editor_Imagick/WP_Image_Editor crop method.

While crop expects integers, integers are not always passed to it.
So the goal is to cast the params to cast (int) before passing them to the method.

Other usage of crop already have int params so only 2 occurrences were fixed.

Tested on:

  • PHP 8.1
  • PHP 8.0

How to reproduce the error:

  1. Go to /wp-admin/media-new.php and upload an image
  2. "Edit" the image
  3. Then do a crop with the mouse and "Apply crop"
  4. See the Implicit conversion from float in the debug log

Trac ticket:
https://core.trac.wordpress.org/ticket/59782

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.

1 participant