From: Christoph M. Becker Date: Mon, 3 Aug 2020 10:01:12 +0000 (+0200) Subject: Fix fix for bug #79877 for PHP 8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9171d8a9354f8e86c43fe319f1c186c6590b2df;p=php Fix fix for bug #79877 for PHP 8 PHP 8 is supposed to throw here. --- 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