You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
imagescale(): Argument #3 ($height) must be between 1 and 2147483647 #17703
Also I think that -2 flips and makes the height twice as much. So any value except 0 should probably be allowed.
Edit: ah not really, this isn't a factor, but a negative value preserves the aspect ratio. According to the manual -1 is even the default.
I found that this error happened because of scaling the file 400x1. While previously the method returned false in such cases, since php 8.4.0 it throws error.
Thank you for your feedbacks)
If both width and height are negative, we should probably throw a ValueError with a suitable message. Not sure if the current behavior qualifies as bug, though (imagescale($im, -1, -1) already throws Argument #2 ($width) must be between 1 and 2147483647, what is not completely wrong).
Activity
devnexen commentedon Feb 5, 2025
That looks like a php issue. transferring.
devnexen commentedon Feb 5, 2025
@valeriiabykovets would you mind sharing your use case to be able to reproduce ?
ndossche commentedon Feb 5, 2025
Probably a negative value flipped the image? Just a guess
devnexen commentedon Feb 5, 2025
So gdImageSx might need to return 0 in this case with height set to -1.
ndossche commentedon Feb 5, 2025
Also I think that -2 flips and makes the height twice as much. So any value except 0 should probably be allowed.
Edit: ah not really, this isn't a factor, but a negative value preserves the aspect ratio. According to the manual -1 is even the default.
valeriiabykovets commentedon Feb 5, 2025
I found that this error happened because of scaling the file 400x1. While previously the method returned false in such cases, since php 8.4.0 it throws error.
Thank you for your feedbacks)
cmb69 commentedon Feb 5, 2025
php-src/ext/gd/gd.c
Line 3959 in dc7161c
If both width and height are negative, we should probably throw a ValueError with a suitable message. Not sure if the current behavior qualifies as bug, though (
imagescale($im, -1, -1)already throwsArgument #2 ($width) must be between 1 and 2147483647, what is not completely wrong).