Skip to content

Fix the argument blamed by the imagepolygon() too few points error - #25372

Closed
lacatoire wants to merge 1 commit into
php:PHP-8.4from
lacatoire:fix/imagepolygon-too-few-points-argument-8.4
Closed

lacatoire wants to merge 1 commit into
php:PHP-8.4from
lacatoire:fix/imagepolygon-too-few-points-argument-8.4

Conversation

@lacatoire

Copy link
Copy Markdown
Member

In the three-argument form, imagepolygon(), imageopenpolygon() and imagefilledpolygon() derive the point count from $points, but the "too few points" error blamed argument 3, which is the colour there. It now blames $points in that form, and argument 3 is kept for the deprecated $num_points form.

To reproduce

<?php
imageopenpolygon(imagecreatetruecolor(20, 20), [1, 1, 2, 2], 0xffffff);

Before: ValueError: imageopenpolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3

After: ValueError: imageopenpolygon(): Argument #2 ($points) must have at least 3 points

@devnexen devnexen closed this in 53b7b06 Nov 11, 2026
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