]> granicus.if.org Git - php/commitdiff
Fix fix for bug #79877 for PHP 8
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 3 Aug 2020 10:01:12 +0000 (12:01 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 3 Aug 2020 10:01:56 +0000 (12:01 +0200)
PHP 8 is supposed to throw here.

ext/standard/image.c
ext/standard/tests/image/bug79877.phpt

index 5c87c9a49aa790f9b8118eed6aec5327abf73b16..7b52ad9719177fc25d5cd27557daaf37264cb85a 100644 (file)
@@ -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) {
index 92e93e59e53e85a50114b3eeacf1cdb4bf4308c8..d7d771b2f2922d39e37e6a9e06f99a2d07a16e3d 100644 (file)
@@ -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