[php-src] PR #25385: Fix the imagecropauto() threshold color error message
| From: | lacatoire | Date: | Wed, 11 Nov 2026 09:39:58 +0000 |
| Subject: | [php-src] PR #25385: Fix the imagecropauto() threshold color error message | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40533@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25385
Author: lacatoire
imagecropauto() in threshold mode reports "must be greater than or equal to
0" for a non-negative colour that is not an index of the palette. Report the palette bound
separately.
```php
<?php
$p = imagecreate(6, 6);
imagecolorallocate($p, 255, 255, 255);
imagecolorallocate($p, 10, 10, 10);
imagecropauto($p, IMG_CROP_THRESHOLD, 0.5, imagecolorstotal($p));
```
Before: ValueError: imagecropauto(): Argument #4 ($color) must be greater than or equal to 0
when using the threshold mode
After: ValueError: imagecropauto(): Argument #4 ($color) must be a valid color index of the
image when using the threshold mode