mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-20070: Return type violation in imagefilter when an invalid filter is provided
This commit is contained in:
4
NEWS
4
NEWS
@@ -13,6 +13,10 @@ PHP NEWS
|
||||
. Fixed bug GH-19974 (fpm_status_export_to_zval segfault for parallel
|
||||
execution). (Jakub Zelenka, txuna)
|
||||
|
||||
- GD:
|
||||
. Fixed bug GH-20070 (Return type violation in imagefilter when an invalid
|
||||
filter is provided). (Girgias)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug GH-20081 (access to uninitialized vars in preload_load()).
|
||||
(Arnaud)
|
||||
|
||||
@@ -3732,9 +3732,11 @@ PHP_FUNCTION(imagefilter)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (filtertype >= 0 && filtertype <= IMAGE_FILTER_MAX) {
|
||||
filters[filtertype](INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
if (UNEXPECTED(filtertype < 0 || filtertype > IMAGE_FILTER_MAX)) {
|
||||
zend_argument_value_error(2, "must be one of the IMG_FILTER_* filter constants");
|
||||
RETURN_THROWS();
|
||||
}
|
||||
filters[filtertype](INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
16
ext/gd/tests/imagefilter_invalid_filter_error.phpt
Normal file
16
ext/gd/tests/imagefilter_invalid_filter_error.phpt
Normal file
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
GH-20070: Testing wrong parameter passing in imagefilter() of GD library
|
||||
--EXTENSIONS--
|
||||
gd
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreatetruecolor(1, 1);
|
||||
|
||||
try {
|
||||
var_dump(imagefilter($image, -1));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ': ', $e->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ValueError: imagefilter(): Argument #2 ($filter) must be one of the IMG_FILTER_* filter constants
|
||||
Reference in New Issue
Block a user