mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix GH-8848: imagecopyresized() error refers to the wrong argument
This commit is contained in:
commit
bc8e52f651
3 changed files with 36 additions and 5 deletions
4
NEWS
4
NEWS
|
@ -2,7 +2,9 @@ PHP NEWS
|
|||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 8.1.9
|
||||
|
||||
|
||||
- GD:
|
||||
. Fixed bug GH-8848 (imagecopyresized() error refers to the wrong argument).
|
||||
(cmb)
|
||||
|
||||
07 Jul 2022, PHP 8.1.8
|
||||
|
||||
|
|
|
@ -3086,22 +3086,22 @@ PHP_FUNCTION(imagecopyresized)
|
|||
dstW = DW;
|
||||
|
||||
if (dstW <= 0) {
|
||||
zend_argument_value_error(3, "must be greater than 0");
|
||||
zend_argument_value_error(7, "must be greater than 0");
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (dstH <= 0) {
|
||||
zend_argument_value_error(4, "must be greater than 0");
|
||||
zend_argument_value_error(8, "must be greater than 0");
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (srcW <= 0) {
|
||||
zend_argument_value_error(5, "must be greater than 0");
|
||||
zend_argument_value_error(9, "must be greater than 0");
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (srcH <= 0) {
|
||||
zend_argument_value_error(6, "must be greater than 0");
|
||||
zend_argument_value_error(10, "must be greater than 0");
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
|
29
ext/gd/tests/gh8848.phpt
Normal file
29
ext/gd/tests/gh8848.phpt
Normal file
|
@ -0,0 +1,29 @@
|
|||
--TEST--
|
||||
GH-8848 (imagecopyresized() error refers to the wrong argument)
|
||||
--EXTENSIONS--
|
||||
gd
|
||||
--FILE--
|
||||
<?php
|
||||
$image1 = imagecreatetruecolor(1, 1);
|
||||
$image2 = imagecreatetruecolor(1, 1);
|
||||
|
||||
$argslist = [
|
||||
[0, 1, 1, 1],
|
||||
[1, 0, 1, 1],
|
||||
[1, 1, 0, 1],
|
||||
[1, 1, 1, 0],
|
||||
];
|
||||
|
||||
foreach ($argslist as $args) {
|
||||
try {
|
||||
imagecopyresized($image1, $image2, 1, 1, 1, 1, ...$args);
|
||||
} catch (ValueError $ex) {
|
||||
echo $ex->getMessage(), PHP_EOL;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
imagecopyresized(): Argument #7 ($dst_width) must be greater than 0
|
||||
imagecopyresized(): Argument #8 ($dst_height) must be greater than 0
|
||||
imagecopyresized(): Argument #9 ($src_width) must be greater than 0
|
||||
imagecopyresized(): Argument #10 ($src_height) must be greater than 0
|
Loading…
Add table
Add a link
Reference in a new issue