com php-src: Fix fix for bug #79877 for PHP 8: ext/standard/image.c ext/standard/tests/image/bug79877.phpt
| From: | Christoph Michael Becker | Date: | Mon, 03 Aug 2020 10:01:56 +0000 |
| Subject: | com php-src: Fix fix for bug #79877 for PHP 8: ext/standard/image.c ext/standard/tests/image/bug79877.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112511@lists.php.net to get a copy of this message | ||
Commit: b9171d8a9354f8e86c43fe319f1c186c6590b2df
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 3 Aug 2020 12:01:12 +0200
Parents: b891adea8d41c1d81696b69f4ae6c5266da730b2
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b9171d8a9354f8e86c43fe319f1c186c6590b2df
Log:
Fix fix for bug #79877 for PHP 8
PHP 8 is supposed to throw here.
Bugs:
https://bugs.php.net/79877
Changed paths:
M ext/standard/image.c
M ext/standard/tests/image/bug79877.phpt
Diff:
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 5c87c9a49a..7b52ad9719 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -1476,8 +1476,8 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
ZEND_PARSE_PARAMETERS_END();
if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) {
- php_error_docref(NULL, E_WARNING, "Invalid path");
- return;
+ zend_argument_type_error(1, "must not contain any null bytes");
+ RETURN_THROWS();
}
if (argc == 2) {
diff --git a/ext/standard/tests/image/bug79877.phpt b/ext/standard/tests/image/bug79877.phpt
index 92e93e59e5..d7d771b2f2 100644
--- a/ext/standard/tests/image/bug79877.phpt
+++ b/ext/standard/tests/image/bug79877.phpt
@@ -5,5 +5,6 @@ Bug #79877 (getimagesize function silently truncates after a null byte)
var_dump(getimagesize("/tmp/a.png\0xx"));
?>
--EXPECTF--
-Warning: getimagesize(): Invalid path in %s on line %d
-NULL
+Fatal error: Uncaught TypeError: getimagesize(): Argument #1 ($image_path) must not contain any
null bytes in %s:%d
+Stack trace:
+%a