diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-08-03 12:01:12 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-08-03 12:01:56 +0200 |
commit | b9171d8a9354f8e86c43fe319f1c186c6590b2df (patch) | |
tree | e764df6ae61f42aafc039f859430974f8ccc8532 | |
parent | b891adea8d41c1d81696b69f4ae6c5266da730b2 (diff) | |
download | php-git-b9171d8a9354f8e86c43fe319f1c186c6590b2df.tar.gz |
Fix fix for bug #79877 for PHP 8
PHP 8 is supposed to throw here.
-rw-r--r-- | ext/standard/image.c | 4 | ||||
-rw-r--r-- | ext/standard/tests/image/bug79877.phpt | 5 |
2 files changed, 5 insertions, 4 deletions
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 |