diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index c0226f8976460..9b80aefaaad0b 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -17,7 +17,7 @@ if (PHP_ZIP != "no") { } AC_DEFINE('HAVE_ZIP', 1, "Define to 1 if the PHP extension 'zip' is available."); - ADD_FLAG("CFLAGS_ZIP", "/D HAVE_SET_MTIME /D HAVE_ENCRYPTION /D HAVE_LIBZIP_VERSION /D HAVE_PROGRESS_CALLBACK /D HAVE_CANCEL_CALLBACK /D HAVE_METHOD_SUPPORTED /D LZMA_API_STATIC"); + ADD_FLAG("CFLAGS_ZIP", "/D HAVE_ENCRYPTION /D HAVE_LIBZIP_VERSION /D HAVE_PROGRESS_CALLBACK /D HAVE_CANCEL_CALLBACK /D HAVE_METHOD_SUPPORTED /D LZMA_API_STATIC"); } else { WARNING("zip not enabled; libraries and headers not found"); } diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 8fd778035ddcb..008e82104e4d3 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -2424,7 +2424,6 @@ PHP_METHOD(ZipArchive, setCompressionIndex) } /* }}} */ -#ifdef HAVE_SET_MTIME /* {{{ Set the modification time of a file in zip, using its name */ PHP_METHOD(ZipArchive, setMtimeName) { @@ -2477,7 +2476,6 @@ PHP_METHOD(ZipArchive, setMtimeIndex) (time_t)mtime, (zip_uint32_t)flags) == 0); } /* }}} */ -#endif /* {{{ Delete a file using its index */ PHP_METHOD(ZipArchive, deleteIndex) diff --git a/ext/zip/php_zip.stub.php b/ext/zip/php_zip.stub.php index 3473d27bf2050..8a37b2508da18 100644 --- a/ext/zip/php_zip.stub.php +++ b/ext/zip/php_zip.stub.php @@ -704,13 +704,11 @@ public function setCommentIndex(int $index, string $comment): bool {} /** @tentative-return-type */ public function setCommentName(string $name, string $comment): bool {} -#ifdef HAVE_SET_MTIME /** @tentative-return-type */ public function setMtimeIndex(int $index, int $timestamp, int $flags = 0): bool {} /** @tentative-return-type */ public function setMtimeName(string $name, int $timestamp, int $flags = 0): bool {} -#endif /** @tentative-return-type */ public function getCommentIndex(int $index, int $flags = 0): string|false {} diff --git a/ext/zip/php_zip_arginfo.h b/ext/zip/php_zip_arginfo.h index ed636339088f0..ba4f867e8af73 100644 --- a/ext/zip/php_zip_arginfo.h +++ b/ext/zip/php_zip_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 53e04d9b2c25cc8a0c9fe51914b5a47280834fb8 */ + * Stub hash: 1f77735273373672b9c8c5b92c46e23ea99faeaf */ ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -138,7 +138,6 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setCo ZEND_ARG_TYPE_INFO(0, comment, IS_STRING, 0) ZEND_END_ARG_INFO() -#if defined(HAVE_SET_MTIME) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setMtimeIndex, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) @@ -150,7 +149,6 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setMt ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_ZipArchive_getCommentIndex, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) @@ -334,10 +332,8 @@ ZEND_METHOD(ZipArchive, setArchiveFlag); ZEND_METHOD(ZipArchive, getArchiveFlag); ZEND_METHOD(ZipArchive, setCommentIndex); ZEND_METHOD(ZipArchive, setCommentName); -#if defined(HAVE_SET_MTIME) ZEND_METHOD(ZipArchive, setMtimeIndex); ZEND_METHOD(ZipArchive, setMtimeName); -#endif ZEND_METHOD(ZipArchive, getCommentIndex); ZEND_METHOD(ZipArchive, getCommentName); ZEND_METHOD(ZipArchive, deleteIndex); @@ -414,10 +410,8 @@ static const zend_function_entry class_ZipArchive_methods[] = { ZEND_ME(ZipArchive, getArchiveFlag, arginfo_class_ZipArchive_getArchiveFlag, ZEND_ACC_PUBLIC) ZEND_ME(ZipArchive, setCommentIndex, arginfo_class_ZipArchive_setCommentIndex, ZEND_ACC_PUBLIC) ZEND_ME(ZipArchive, setCommentName, arginfo_class_ZipArchive_setCommentName, ZEND_ACC_PUBLIC) -#if defined(HAVE_SET_MTIME) ZEND_ME(ZipArchive, setMtimeIndex, arginfo_class_ZipArchive_setMtimeIndex, ZEND_ACC_PUBLIC) ZEND_ME(ZipArchive, setMtimeName, arginfo_class_ZipArchive_setMtimeName, ZEND_ACC_PUBLIC) -#endif ZEND_ME(ZipArchive, getCommentIndex, arginfo_class_ZipArchive_getCommentIndex, ZEND_ACC_PUBLIC) ZEND_ME(ZipArchive, getCommentName, arginfo_class_ZipArchive_getCommentName, ZEND_ACC_PUBLIC) ZEND_ME(ZipArchive, deleteIndex, arginfo_class_ZipArchive_deleteIndex, ZEND_ACC_PUBLIC) diff --git a/ext/zip/tests/oo_setmtime.phpt b/ext/zip/tests/oo_setmtime.phpt index 8c3c4eb7cca32..bf34dd722b519 100644 --- a/ext/zip/tests/oo_setmtime.phpt +++ b/ext/zip/tests/oo_setmtime.phpt @@ -2,11 +2,6 @@ setMtime --EXTENSIONS-- zip ---SKIPIF-- - --INI-- date.timezone=UTC --FILE-- diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index c0283b49eaaf3..76e4588f249e5 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -49,18 +49,11 @@ static ssize_t php_zip_ops_read(php_stream *stream, char *buf, size_t count) if (self->zf) { n = zip_fread(self->zf, buf, count); if (n < 0) { -#if LIBZIP_VERSION_MAJOR < 1 - int ze, se; - zip_file_error_get(self->zf, &ze, &se); - stream->eof = 1; - php_error_docref(NULL, E_WARNING, "Zip stream error: %s", zip_file_strerror(self->zf)); -#else zip_error_t *err; err = zip_file_get_error(self->zf); stream->eof = 1; php_error_docref(NULL, E_WARNING, "Zip stream error: %s", zip_error_strerror(err)); zip_error_fini(err); -#endif return -1; } /* cast count to signed value to avoid possibly negative n