summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/image.c4
-rw-r--r--ext/standard/tests/image/bug79877.phpt5
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