mirror of
https://github.com/php/php-src.git
synced 2024-12-20 07:20:33 +08:00
raise ValueError from imagecreate/imagecreatetruecolor
Raise a ValueError instead of a plain Error when calling imagecreate() or imagecreatetruecolor() with too big or small values for the width or height arguments.
This commit is contained in:
parent
bc61997571
commit
a43679632b
@ -829,12 +829,12 @@ PHP_FUNCTION(imagecreatetruecolor)
|
||||
}
|
||||
|
||||
if (x_size <= 0 || x_size >= INT_MAX) {
|
||||
zend_throw_error(NULL, "Invalid width (x_size)");
|
||||
zend_value_error("Invalid width (x_size)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (y_size <= 0 || y_size >= INT_MAX) {
|
||||
zend_throw_error(NULL, "Invalid height (y_size)");
|
||||
zend_value_error("Invalid height (y_size)");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1473,12 +1473,12 @@ PHP_FUNCTION(imagecreate)
|
||||
}
|
||||
|
||||
if (x_size <= 0 || x_size >= INT_MAX) {
|
||||
zend_throw_error(NULL, "Invalid width (x_size)");
|
||||
zend_value_error("Invalid width (x_size)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (y_size <= 0 || y_size >= INT_MAX) {
|
||||
zend_throw_error(NULL, "Invalid height (y_size)");
|
||||
zend_value_error("Invalid height (y_size)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,5 +17,5 @@ trycatch_dump(
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
!! [Error] Invalid width (x_size)
|
||||
!! [Error] Invalid height (y_size)
|
||||
!! [ValueError] Invalid width (x_size)
|
||||
!! [ValueError] Invalid height (y_size)
|
||||
|
@ -19,5 +19,5 @@ trycatch_dump(
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
!! [Error] Invalid width (x_size)
|
||||
!! [Error] Invalid height (y_size)
|
||||
!! [ValueError] Invalid width (x_size)
|
||||
!! [ValueError] Invalid height (y_size)
|
||||
|
Loading…
Reference in New Issue
Block a user