[php-src] PR #23541: ext/gd: report $size with the argument number of the function called
| From: | lacatoire | Date: | Wed, 02 Sep 2026 12:00:34 +0000 |
| Subject: | [php-src] PR #23541: ext/gd: report $size with the argument number of the function called | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38264@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23541
Author: lacatoire
php_imagettftext_common() backs four functions with two signatures: $size
is argument #1 of imageftbbox() and imagettfbbox(), and #2 of
imagefttext() and imagettftext(), which take the image first. Both size
checks hardcode 2, so the bbox pair blames $angle:
```php
imageftbbox(NAN, 0.0, $font, 'A');
// ValueError: imageftbbox(): Argument #2 ($angle) must be finite
```
$angle was 0.0. The type error for the same parameter already says #1,
since that one comes from the arginfo:
```php
imageftbbox('x', 0.0, $font, 'A');
// TypeError: imageftbbox(): Argument #1 ($size) must be of type float, string given
```
The number is now derived from the mode the helper was called in; the drawing pair keeps 2.
The added test covers all four functions, in the order the checks run: the range test precedes the
finite test, so INF reports "must be between" while NAN, false
against both bounds, falls through to "must be finite".
Only the two bbox messages change, so this targets master.