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

[BUGFIX] Prevent float values from going into the crop function #86

Merged
merged 1 commit into from Dec 29, 2022
Merged

Conversation

Woeler
Copy link
Contributor

@Woeler Woeler commented Dec 15, 2022

We ran into the issue that float values were passed to the crop function. This resulted in an error, as the crop function only wants integers. This PR fixes that. Below you can see the logged $cropperData that was passed into the cropImage function on our live environment.

{
    "data": {
        "stdClass": {
            "width": 2012,
            "height": 1132,
            "left": 128,
            "top": 119.01869791425563
        }
    }
}

Error

crop() accepts only integer values as argument 4. {"userId":2,"exception":"[object] (Intervention\\Image\\Exception\\InvalidArgumentException(code: 0): crop() accepts only integer values as argument 4. at /home/user/domain.com/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php:138) 

@sonarcloud
Copy link

sonarcloud bot commented Dec 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Woeler Woeler changed the title [TASK] Prevent float values from going into the crop function Prevent float values from going into the crop function Dec 15, 2022
@Woeler Woeler changed the title Prevent float values from going into the crop function [BUGFIX] Prevent float values from going into the crop function Dec 15, 2022
@ctessier
Copy link
Owner

Thank you for the contribution @Woeler! And for your support for this package 🙏 !

Do you have step to reproduce maybe?
I'll have a look asap.

Thank you

@Woeler
Copy link
Contributor Author

Woeler commented Dec 17, 2022

Unfortunately I cannot reproduce it locally. One of our editors ran into the issue with a particular file on our live environment. I can reproduce the issue on the live environment with that particular file. But otherwise I cannot reproduce it, not even locally with the same file. It is very odd. However, the error does occur for some reason, so I suppose in time, it will occur for other users as well. The reasons for the error are beyond me though to be honest.

@ctessier ctessier merged commit 1223051 into ctessier:2.x Dec 29, 2022
@ctessier
Copy link
Owner

Pull request released in v2.0.2

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.

None yet

2 participants