diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 883b6f6d40a12..f93140da5cd22 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -289,11 +289,13 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam } if (!expand_filepath(filename, resolved_path)) { + php_error_docref(NULL, E_WARNING, "No such file or directory"); return -1; } php_stat(resolved_path, strlen(resolved_path), FS_EXISTS, &exists_flag); if (Z_TYPE(exists_flag) == IS_FALSE) { + php_error_docref(NULL, E_WARNING, "No such file or directory"); return -1; } @@ -1166,6 +1168,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open) } if(!expand_filepath(ZSTR_VAL(filename), resolved_path)) { + php_error_docref(NULL, E_WARNING, "No such file or directory"); RETURN_FALSE; } @@ -1456,6 +1459,7 @@ static ZIPARCHIVE_METHOD(open) } if (!(resolved_path = expand_filepath(ZSTR_VAL(filename), NULL))) { + php_error_docref(NULL, E_WARNING, "No such file or directory"); RETURN_FALSE; } diff --git a/ext/zip/tests/bug64342_0.phpt b/ext/zip/tests/bug64342_0.phpt index 96e9667dda571..39930790b48df 100644 --- a/ext/zip/tests/bug64342_0.phpt +++ b/ext/zip/tests/bug64342_0.phpt @@ -37,6 +37,8 @@ DONE @unlink(__DIR__ . '/bug64342.zip'); --EXPECTF-- %s.txt + +Warning: ZipArchive::addFile(): No such file or directory in %s on line %d add failed close ok DONE diff --git a/ext/zip/tests/bug64342_1-mb.phpt b/ext/zip/tests/bug64342_1-mb.phpt index 6b14c7fb5dc02..595b3cf99bd51 100644 --- a/ext/zip/tests/bug64342_1-mb.phpt +++ b/ext/zip/tests/bug64342_1-mb.phpt @@ -37,6 +37,7 @@ if ($zip->status == ZIPARCHIVE::ER_OK) { } @unlink($file); ?> ---EXPECT-- +--EXPECTF-- +Warning: ZipArchive::addFile(): No such file or directory in %s on line %d failed OK diff --git a/ext/zip/tests/bug64342_1.phpt b/ext/zip/tests/bug64342_1.phpt index 13d8a6d388525..403f953ae5578 100644 --- a/ext/zip/tests/bug64342_1.phpt +++ b/ext/zip/tests/bug64342_1.phpt @@ -37,6 +37,7 @@ if ($zip->status == ZIPARCHIVE::ER_OK) { } @unlink($file); ?> ---EXPECT-- +--EXPECTF-- +Warning: ZipArchive::addFile(): No such file or directory in %s on line %d failed OK