[php-src] Issue #20070: ext/gd: Return type violation in `imagefilter` when an invalid filter is provided
| From: | Girgias | Date: | Sun, 05 Oct 2025 12:41:43 +0000 |
| Subject: | [php-src] Issue #20070: ext/gd: Return type violation in `imagefilter` when an invalid filter is provided | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250990@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20070
Author: Girgias
### Description
The following code:
```php
<?php
$image = imagecreatetruecolor(180, 30);
try {
var_dump(imagefilter($image, -1));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
```
Resulted in this output:
```
Fatal error: imagefilter(): Return value must be of type bool, null returned in Unknown on line 0
```
But I expected this output instead:
```
ValueError: imagefilter(): Argument #2 ($filter) must be a valid filter
```
Found by just staring at the code when double-checking #20066
### PHP Version
```plain
latest
```
### Operating System
_No response_