Skip to content

Commit b9171d8

Browse files
committed
Fix fix for bug #79877 for PHP 8
PHP 8 is supposed to throw here.
1 parent b891ade commit b9171d8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ext/standard/image.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,8 +1476,8 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
14761476
ZEND_PARSE_PARAMETERS_END();
14771477

14781478
if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) {
1479-
php_error_docref(NULL, E_WARNING, "Invalid path");
1480-
return;
1479+
zend_argument_type_error(1, "must not contain any null bytes");
1480+
RETURN_THROWS();
14811481
}
14821482

14831483
if (argc == 2) {

ext/standard/tests/image/bug79877.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ Bug #79877 (getimagesize function silently truncates after a null byte)
55
var_dump(getimagesize("/tmp/a.png\0xx"));
66
?>
77
--EXPECTF--
8-
Warning: getimagesize(): Invalid path in %s on line %d
9-
NULL
8+
Fatal error: Uncaught TypeError: getimagesize(): Argument #1 ($image_path) must not contain any null bytes in %s:%d
9+
Stack trace:
10+
%a

0 commit comments

Comments
 (0)