Skip to content

ext/gd: fix the wording of the imagejpeg() quality error - #23560

Closed
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:fix/imagejpeg-quality-message-upstream
Closed

ext/gd: fix the wording of the imagejpeg() quality error#23560
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:fix/imagejpeg-quality-message-upstream

Conversation

@lacatoire

Copy link
Copy Markdown
Member

imagejpeg() rejects an out of range $quality with "must be at between -1 and 100". imageavif(), a few lines above in the same file, checks the same bounds and words the message without the stray word.

The existing expectation is updated and a test pins the accepted range.

The message read "must be at between -1 and 100". The sibling writers,
imageavif() in particular, use the same bounds without the stray word.
@devnexen

devnexen commented Sep 4, 2026

Copy link
Copy Markdown
Member

please do 1 gd PR. Thanks.

foreach ([-2, -1, 0, 100, 101] as $quality) {
try {
var_dump(imagejpeg($image, $file, $quality));
} catch (ValueError $e) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also you need to teach your agent to make the proper error format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants