mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'PHP-8.4'
This commit is contained in:
commit
65a20d5a09
2 changed files with 22 additions and 0 deletions
|
@ -3956,6 +3956,11 @@ PHP_FUNCTION(imagescale)
|
||||||
|
|
||||||
im = php_gd_libgdimageptr_from_zval_p(IM);
|
im = php_gd_libgdimageptr_from_zval_p(IM);
|
||||||
|
|
||||||
|
if (tmp_h < 0 && tmp_w < 0) {
|
||||||
|
zend_value_error("Argument #2 ($width) and argument #3 ($height) cannot be both negative");
|
||||||
|
RETURN_THROWS();
|
||||||
|
}
|
||||||
|
|
||||||
if (tmp_h < 0 || tmp_w < 0) {
|
if (tmp_h < 0 || tmp_w < 0) {
|
||||||
/* preserve ratio */
|
/* preserve ratio */
|
||||||
long src_x, src_y;
|
long src_x, src_y;
|
||||||
|
|
17
ext/gd/tests/gh17703.phpt
Normal file
17
ext/gd/tests/gh17703.phpt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
--TEST--
|
||||||
|
GH-17703 both width and height value being negative triggers ValueError on width.
|
||||||
|
--EXTENSIONS--
|
||||||
|
gd
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$img = imagecreatetruecolor ( 256, 1);
|
||||||
|
|
||||||
|
try {
|
||||||
|
imagescale($img, -1, -1, 0);
|
||||||
|
} catch (\ValueError $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
Argument #2 ($width) and argument #3 ($height) cannot be both negative
|
Loading…
Add table
Add a link
Reference in a new issue