From d8814bb56c836d0d76f8353ef82c16b2f80ff9ca Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 24 Apr 2024 15:19:39 +0200 Subject: [PATCH] compatibility with 8.4 --- config.m4 | 4 ++-- config.w32 | 2 ++ package.xml | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.m4 b/config.m4 index 97f687a..e196729 100644 --- a/config.m4 +++ b/config.m4 @@ -27,8 +27,8 @@ if test "$PHP_ZIP" != "no"; then elif test $PHP_VERSION -lt 80100; then AC_MSG_RESULT(8.0) subdir=php8 - elif test $PHP_VERSION -lt 80400; then - AC_MSG_RESULT(8.1/8.2/8.3) + elif test $PHP_VERSION -lt 80500; then + AC_MSG_RESULT(8.1/8.2/8.3/8.4) subdir=php81 else AC_MSG_ERROR(PHP version $PHP_VERSION is not supported yet) From d66c502aa9bba9aed8b553098e80ff9902207927 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sat, 1 Jun 2024 14:07:06 +0200 Subject: [PATCH] Add missing pcre dependency definition to zip extension The zip extension also requires the pcre extension. --- config.m4 | 1 + config.w32 | 1 + php5/php_zip.c | 8 +++++++- php7/php_zip.c | 8 +++++++- php73/php_zip.c | 8 +++++++- php74/php_zip.c | 8 +++++++- php8/php_zip.c | 8 +++++++- php81/php_zip.c | 8 +++++++- 8 files changed, 44 insertions(+), 6 deletions(-) diff --git a/config.m4 b/config.m4 index e196729..0b4669b 100644 --- a/config.m4 +++ b/config.m4 @@ -142,6 +142,7 @@ if test "$PHP_ZIP" != "no"; then AC_DEFINE(HAVE_ZIP,1,[ ]) PHP_NEW_EXTENSION(zip, $PHP_ZIP_SOURCES, $ext_shared,, $LIBZIP_CFLAGS) + PHP_ADD_EXTENSION_DEP(zip, pcre) else AC_MSG_ERROR([libzip is no more bundled: install libzip version >= 0.11 (1.3.0 recommended for encryption and bzip2 support)]) fi diff --git a/php5/php_zip.c b/php5/php_zip.c index 0b61c0d..eccd1cc 100644 --- a/php5/php_zip.c +++ b/php5/php_zip.c @@ -1338,10 +1338,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip); static PHP_MINFO_FUNCTION(zip); /* }}} */ +static const zend_module_dep zip_deps[] = { + ZEND_MOD_REQUIRED("pcre") + ZEND_MOD_END +}; + /* {{{ zip_module_entry */ zend_module_entry zip_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, NULL, + zip_deps, "zip", zip_functions, PHP_MINIT(zip), diff --git a/php7/php_zip.c b/php7/php_zip.c index 0470d52..aa8b71e 100644 --- a/php7/php_zip.c +++ b/php7/php_zip.c @@ -1226,10 +1226,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip); static PHP_MINFO_FUNCTION(zip); /* }}} */ +static const zend_module_dep zip_deps[] = { + ZEND_MOD_REQUIRED("pcre") + ZEND_MOD_END +}; + /* {{{ zip_module_entry */ zend_module_entry zip_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, NULL, + zip_deps, "zip", zip_functions, PHP_MINIT(zip), diff --git a/php73/php_zip.c b/php73/php_zip.c index e56a94d..ee68b0f 100644 --- a/php73/php_zip.c +++ b/php73/php_zip.c @@ -1229,10 +1229,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip); static PHP_MINFO_FUNCTION(zip); /* }}} */ +static const zend_module_dep zip_deps[] = { + ZEND_MOD_REQUIRED("pcre") + ZEND_MOD_END +}; + /* {{{ zip_module_entry */ zend_module_entry zip_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, NULL, + zip_deps, "zip", zip_functions, PHP_MINIT(zip), diff --git a/php74/php_zip.c b/php74/php_zip.c index 52ae83d..3c4c509 100644 --- a/php74/php_zip.c +++ b/php74/php_zip.c @@ -1241,10 +1241,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip); static PHP_MINFO_FUNCTION(zip); /* }}} */ +static const zend_module_dep zip_deps[] = { + ZEND_MOD_REQUIRED("pcre") + ZEND_MOD_END +}; + /* {{{ zip_module_entry */ zend_module_entry zip_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, NULL, + zip_deps, "zip", zip_functions, PHP_MINIT(zip), diff --git a/php8/php_zip.c b/php8/php_zip.c index 34bddd1..93d633b 100644 --- a/php8/php_zip.c +++ b/php8/php_zip.c @@ -1141,10 +1141,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip); static PHP_MINFO_FUNCTION(zip); /* }}} */ +static const zend_module_dep zip_deps[] = { + ZEND_MOD_REQUIRED("pcre") + ZEND_MOD_END +}; + /* {{{ zip_module_entry */ zend_module_entry zip_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, NULL, "zip", + zip_deps, ext_functions, PHP_MINIT(zip), PHP_MSHUTDOWN(zip), diff --git a/php81/php_zip.c b/php81/php_zip.c index 274ddf1..97194ba 100644 --- a/php81/php_zip.c +++ b/php81/php_zip.c @@ -1156,9 +1156,15 @@ static PHP_MSHUTDOWN_FUNCTION(zip); static PHP_MINFO_FUNCTION(zip); /* }}} */ +static const zend_module_dep zip_deps[] = { + ZEND_MOD_REQUIRED("pcre") + ZEND_MOD_END +}; + /* {{{ zip_module_entry */ zend_module_entry zip_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, NULL, + zip_deps, "zip", ext_functions, PHP_MINIT(zip), From 6734db54ab2c9176e58ae456b794657374688fba Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 21 Aug 2024 14:43:10 +0200 Subject: [PATCH] fix init --- php8/php_zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php8/php_zip.c b/php8/php_zip.c index 93d633b..9b388a6 100644 --- a/php8/php_zip.c +++ b/php8/php_zip.c @@ -1149,8 +1149,8 @@ static const zend_module_dep zip_deps[] = { /* {{{ zip_module_entry */ zend_module_entry zip_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, - "zip", zip_deps, + "zip", ext_functions, PHP_MINIT(zip), PHP_MSHUTDOWN(zip), -- 2.46.0 From 9465fc87fdc5cf95527b6e0fe94d12cf23dec138 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 19 Sep 2024 14:16:29 +0200 Subject: [PATCH] add ZipArchive::ER_TRUNCATED_ZIP added in libzip 1.11 --- package.xml | 1 + php5/php_zip.c | 3 +++ php7/php_zip.c | 3 +++ php73/php_zip.c | 3 +++ php74/php_zip.c | 3 +++ php8/php_zip.c | 3 +++ php81/php_zip.stub.php | 7 +++++++ php81/php_zip_arginfo.h | 32 ++++++++++++++++++++++---------- 8 files changed, 45 insertions(+), 10 deletions(-) diff --git a/php5/php_zip.c b/php5/php_zip.c index eccd1cc..10762e3 100644 --- a/php5/php_zip.c +++ b/php5/php_zip.c @@ -3971,6 +3971,9 @@ static PHP_MINIT_FUNCTION(zip) #ifdef ZIP_ER_NOT_ALLOWED REGISTER_ZIP_CLASS_CONST_LONG("ER_NOT_ALLOWED", ZIP_ER_NOT_ALLOWED); /* Not allowed in torrentzip */ #endif +#ifdef ZIP_ER_TRUNCATED_ZIP + REGISTER_ZIP_CLASS_CONST_LONG("ER_TRUNCATED_ZIP", ZIP_ER_TRUNCATED_ZIP); /* Possibly truncated or corrupted zip archive */ +#endif #ifdef ZIP_AFL_RDONLY REGISTER_ZIP_CLASS_CONST_LONG("AFL_RDONLY", ZIP_AFL_RDONLY); /* read only -- cannot be cleared */ #endif diff --git a/php7/php_zip.c b/php7/php_zip.c index aa8b71e..009cdb5 100644 --- a/php7/php_zip.c +++ b/php7/php_zip.c @@ -3871,6 +3871,9 @@ static PHP_MINIT_FUNCTION(zip) #ifdef ZIP_ER_NOT_ALLOWED REGISTER_ZIP_CLASS_CONST_LONG("ER_NOT_ALLOWED", ZIP_ER_NOT_ALLOWED); /* Not allowed in torrentzip */ #endif +#ifdef ZIP_ER_TRUNCATED_ZIP + REGISTER_ZIP_CLASS_CONST_LONG("ER_TRUNCATED_ZIP", ZIP_ER_TRUNCATED_ZIP); /* Possibly truncated or corrupted zip archive */ +#endif #ifdef ZIP_AFL_RDONLY REGISTER_ZIP_CLASS_CONST_LONG("AFL_RDONLY", ZIP_AFL_RDONLY); /* read only -- cannot be cleared */ #endif diff --git a/php73/php_zip.c b/php73/php_zip.c index ee68b0f..33b8e0d 100644 --- a/php73/php_zip.c +++ b/php73/php_zip.c @@ -3871,6 +3871,9 @@ static PHP_MINIT_FUNCTION(zip) #ifdef ZIP_ER_NOT_ALLOWED REGISTER_ZIP_CLASS_CONST_LONG("ER_NOT_ALLOWED", ZIP_ER_NOT_ALLOWED); /* Not allowed in torrentzip */ #endif +#ifdef ZIP_ER_TRUNCATED_ZIP + REGISTER_ZIP_CLASS_CONST_LONG("ER_TRUNCATED_ZIP", ZIP_ER_TRUNCATED_ZIP); /* Possibly truncated or corrupted zip archive */ +#endif #ifdef ZIP_AFL_RDONLY REGISTER_ZIP_CLASS_CONST_LONG("AFL_RDONLY", ZIP_AFL_RDONLY); /* read only -- cannot be cleared */ #endif diff --git a/php74/php_zip.c b/php74/php_zip.c index 3c4c509..5c078e7 100644 --- a/php74/php_zip.c +++ b/php74/php_zip.c @@ -3716,6 +3716,9 @@ static PHP_MINIT_FUNCTION(zip) #ifdef ZIP_ER_NOT_ALLOWED REGISTER_ZIP_CLASS_CONST_LONG("ER_NOT_ALLOWED", ZIP_ER_NOT_ALLOWED); /* Not allowed in torrentzip */ #endif +#ifdef ZIP_ER_TRUNCATED_ZIP + REGISTER_ZIP_CLASS_CONST_LONG("ER_TRUNCATED_ZIP", ZIP_ER_TRUNCATED_ZIP); /* Possibly truncated or corrupted zip archive */ +#endif #ifdef ZIP_AFL_RDONLY REGISTER_ZIP_CLASS_CONST_LONG("AFL_RDONLY", ZIP_AFL_RDONLY); /* read only -- cannot be cleared */ #endif diff --git a/php8/php_zip.c b/php8/php_zip.c index 9b388a6..60fc3c3 100644 --- a/php8/php_zip.c +++ b/php8/php_zip.c @@ -3275,6 +3275,9 @@ static PHP_MINIT_FUNCTION(zip) #ifdef ZIP_ER_NOT_ALLOWED REGISTER_ZIP_CLASS_CONST_LONG("ER_NOT_ALLOWED", ZIP_ER_NOT_ALLOWED); /* Not allowed in torrentzip */ #endif +#ifdef ZIP_ER_TRUNCATED_ZIP + REGISTER_ZIP_CLASS_CONST_LONG("ER_TRUNCATED_ZIP", ZIP_ER_TRUNCATED_ZIP); /* Possibly truncated or corrupted zip archive */ +#endif #ifdef ZIP_AFL_RDONLY REGISTER_ZIP_CLASS_CONST_LONG("AFL_RDONLY", ZIP_AFL_RDONLY); /* read only -- cannot be cleared */ #endif diff --git a/php81/php_zip.stub.php b/php81/php_zip.stub.php index ada319c..b63b9b2 100644 --- a/php81/php_zip.stub.php +++ b/php81/php_zip.stub.php @@ -447,6 +447,13 @@ class ZipArchive implements Countable */ public const int ER_NOT_ALLOWED = UNKNOWN; #endif +#ifdef ZIP_ER_TRUNCATED_ZIP + /** + * Possibly truncated or corrupted zip archive + * @cvalue ZIP_ER_TRUNCATED_ZIP + */ + public const int ER_TRUNCATED_ZIP = UNKNOWN; +#endif #ifdef ZIP_AFL_RDONLY /** * read only -- cannot be cleared diff --git a/php81/php_zip_arginfo.h b/php81/php_zip_arginfo.h index 1dd63b9..ce0807e 100644 --- a/php81/php_zip_arginfo.h +++ b/php81/php_zip_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6583f915b8f46a9eb83877e9d0f97e1d2d489852 */ + * Stub hash: 34c92091053addd2aeb353e454fb390509fa4056 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -1281,6 +1281,18 @@ static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry #endif zend_string_release(const_ER_NOT_ALLOWED_name); #endif +#if defined(ZIP_ER_TRUNCATED_ZIP) + + zval const_ER_TRUNCATED_ZIP_value; + ZVAL_LONG(&const_ER_TRUNCATED_ZIP_value, ZIP_ER_TRUNCATED_ZIP); + zend_string *const_ER_TRUNCATED_ZIP_name = zend_string_init_interned("ER_TRUNCATED_ZIP", sizeof("ER_TRUNCATED_ZIP") - 1, 1); +#if (PHP_VERSION_ID >= 80300) + zend_declare_typed_class_constant(class_entry, const_ER_TRUNCATED_ZIP_name, &const_ER_TRUNCATED_ZIP_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); +#else + zend_declare_class_constant_ex(class_entry, const_ER_TRUNCATED_ZIP_name, &const_ER_TRUNCATED_ZIP_value, ZEND_ACC_PUBLIC, NULL); +#endif + zend_string_release(const_ER_TRUNCATED_ZIP_name); +#endif #if defined(ZIP_AFL_RDONLY) zval const_AFL_RDONLY_value; @@ -1718,20 +1730,20 @@ static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry zend_string_release(property_comment_name); - zend_string *attribute_name_SensitiveParameter_ZipArchive_setPassword_arg0 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); - zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setpassword", sizeof("setpassword") - 1), 0, attribute_name_SensitiveParameter_ZipArchive_setPassword_arg0, 0); - zend_string_release(attribute_name_SensitiveParameter_ZipArchive_setPassword_arg0); + zend_string *attribute_name_SensitiveParameter_func_setpassword_arg0_0 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); + zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setpassword", sizeof("setpassword") - 1), 0, attribute_name_SensitiveParameter_func_setpassword_arg0_0, 0); + zend_string_release(attribute_name_SensitiveParameter_func_setpassword_arg0_0); #if defined(HAVE_ENCRYPTION) - zend_string *attribute_name_SensitiveParameter_ZipArchive_setEncryptionName_arg2 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); - zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setencryptionname", sizeof("setencryptionname") - 1), 2, attribute_name_SensitiveParameter_ZipArchive_setEncryptionName_arg2, 0); - zend_string_release(attribute_name_SensitiveParameter_ZipArchive_setEncryptionName_arg2); + zend_string *attribute_name_SensitiveParameter_func_setencryptionname_arg2_0 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); + zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setencryptionname", sizeof("setencryptionname") - 1), 2, attribute_name_SensitiveParameter_func_setencryptionname_arg2_0, 0); + zend_string_release(attribute_name_SensitiveParameter_func_setencryptionname_arg2_0); #endif #if defined(HAVE_ENCRYPTION) - zend_string *attribute_name_SensitiveParameter_ZipArchive_setEncryptionIndex_arg2 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); - zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setencryptionindex", sizeof("setencryptionindex") - 1), 2, attribute_name_SensitiveParameter_ZipArchive_setEncryptionIndex_arg2, 0); - zend_string_release(attribute_name_SensitiveParameter_ZipArchive_setEncryptionIndex_arg2); + zend_string *attribute_name_SensitiveParameter_func_setencryptionindex_arg2_0 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); + zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setencryptionindex", sizeof("setencryptionindex") - 1), 2, attribute_name_SensitiveParameter_func_setencryptionindex_arg2_0, 0); + zend_string_release(attribute_name_SensitiveParameter_func_setencryptionindex_arg2_0); #endif return class_entry; From e482dbfda515fded9deeff9d48823266b10f7f4e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 20 Sep 2024 15:36:19 +0200 Subject: [PATCH] sync with master (8.4) --- php81/php_zip.c | 51 ++++---- php81/php_zip.stub.php | 22 ++-- php81/php_zip_arginfo.h | 257 +++++++++++++++++++++++++++++-------- php81/zip_stream.c | 2 - tests/oo_getcomment2.phpt | 4 +- tests/oo_open2.phpt | 4 +- tests/zip_open_error2.phpt | 6 +- 7 files changed, 250 insertions(+), 96 deletions(-) diff --git a/php81/php_zip.c b/php81/php_zip.c index 97194ba..9fee614 100644 --- a/php81/php_zip.c +++ b/php81/php_zip.c @@ -16,14 +16,14 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "ext/standard/file.h" -#include "ext/standard/php_string.h" +#include "ext/standard/php_string.h" /* For php_basename() */ #include "ext/pcre/php_pcre.h" #include "ext/standard/php_filestat.h" #include "zend_attributes.h" @@ -43,6 +43,10 @@ #define zend_zval_value_name(opt) zend_zval_type_name(opt) #endif +#if PHP_VERSION_ID < 80400 +#define zend_argument_must_not_be_empty_error(n) zend_argument_value_error(n, "must not be empty"); +#endif + /* {{{ Resource le */ static int le_zip_dir; #define le_zip_dir_name "Zip Directory" @@ -61,7 +65,7 @@ static int le_zip_entry; This is always used for the first argument*/ #define PHP_ZIP_STAT_PATH(za, path, path_len, flags, sb) \ if (path_len == 0) { \ - zend_argument_value_error(1, "cannot be empty"); \ + zend_argument_must_not_be_empty_error(1); \ RETURN_THROWS(); \ } \ if (zip_stat(za, path, flags, &sb) != 0) { \ @@ -176,7 +180,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s is_dir_only = 1; } else { memcpy(file_dirname, path_cleaned, path_cleaned_len); - dir_len = php_dirname(file_dirname, path_cleaned_len); + dir_len = zend_dirname(file_dirname, path_cleaned_len); if (!dir_len || (dir_len == 1 && file_dirname[0] == '.')) { len = spprintf(&file_dirname_fullpath, 0, "%s", dest); @@ -422,7 +426,7 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) } if (Z_STRLEN_P(option) == 0) { - zend_value_error("Option \"remove_path\" cannot be empty"); + zend_value_error("Option \"remove_path\" must not be empty"); return -1; } @@ -442,7 +446,7 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) } if (Z_STRLEN_P(option) == 0) { - zend_value_error("Option \"add_path\" cannot be empty"); + zend_value_error("Option \"add_path\" must not be empty"); return -1; } @@ -953,11 +957,12 @@ static zval *php_zip_read_property(zend_object *object, zend_string *name, int t } /* }}} */ +// todo: make php_zip_has_property return bool as well static int php_zip_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { ze_zip_object *obj; zip_prop_handler *hnd = NULL; - int retval = 0; + bool retval = false; obj = php_zip_fetch_object(object); @@ -969,7 +974,7 @@ static int php_zip_has_property(zend_object *object, zend_string *name, int type zval tmp, *prop; if (type == 2) { - retval = 1; + retval = true; } else if ((prop = php_zip_property_reader(obj, hnd, &tmp)) != NULL) { if (type == 1) { retval = zend_is_true(&tmp); @@ -1195,7 +1200,7 @@ PHP_FUNCTION(zip_open) } if (ZSTR_LEN(filename) == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -1477,7 +1482,7 @@ PHP_METHOD(ZipArchive, open) ze_obj = Z_ZIP_P(self); if (ZSTR_LEN(filename) == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -1764,7 +1769,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* } if (ZSTR_LEN(pattern) == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } if (options && zend_hash_num_elements(options) > 0 && (php_zip_parse_options(options, &opts) < 0)) { @@ -1882,7 +1887,7 @@ PHP_METHOD(ZipArchive, addFile) } if (ZSTR_LEN(filename) == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -1915,7 +1920,7 @@ PHP_METHOD(ZipArchive, replaceFile) } if (ZSTR_LEN(filename) == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2179,7 +2184,7 @@ PHP_METHOD(ZipArchive, setCommentName) } if (name_len == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2246,7 +2251,7 @@ PHP_METHOD(ZipArchive, setExternalAttributesName) ZIP_FROM_OBJECT(intern, self); if (name_len == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2307,7 +2312,7 @@ PHP_METHOD(ZipArchive, getExternalAttributesName) ZIP_FROM_OBJECT(intern, self); if (name_len == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2374,7 +2379,7 @@ PHP_METHOD(ZipArchive, setEncryptionName) ZIP_FROM_OBJECT(intern, self); if (name_len == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2435,7 +2440,7 @@ PHP_METHOD(ZipArchive, getCommentName) ZIP_FROM_OBJECT(intern, self); if (name_len == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2491,7 +2496,7 @@ PHP_METHOD(ZipArchive, setCompressionName) ZIP_FROM_OBJECT(intern, this); if (name_len == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2551,7 +2556,7 @@ PHP_METHOD(ZipArchive, setMtimeName) ZIP_FROM_OBJECT(intern, this); if (name_len == 0) { - zend_argument_value_error(1, "cannot be empty"); + zend_argument_must_not_be_empty_error(1); RETURN_THROWS(); } @@ -2665,7 +2670,7 @@ PHP_METHOD(ZipArchive, renameIndex) ZIP_FROM_OBJECT(intern, self); if (new_name_len == 0) { - zend_argument_value_error(2, "cannot be empty"); + zend_argument_must_not_be_empty_error(2); RETURN_THROWS(); } @@ -2693,7 +2698,7 @@ PHP_METHOD(ZipArchive, renameName) ZIP_FROM_OBJECT(intern, self); if (new_name_len == 0) { - zend_argument_value_error(2, "cannot be empty"); + zend_argument_must_not_be_empty_error(2); RETURN_THROWS(); } @@ -3181,6 +3186,8 @@ static PHP_MINIT_FUNCTION(zip) php_register_url_stream_wrapper("zip", &php_stream_zip_wrapper); + register_php_zip_symbols(module_number); + le_zip_dir = zend_register_list_destructors_ex(php_zip_free_dir, NULL, le_zip_dir_name, module_number); le_zip_entry = zend_register_list_destructors_ex(php_zip_free_entry, NULL, le_zip_entry_name, module_number); diff --git a/php81/php_zip.stub.php b/php81/php_zip.stub.php index b63b9b2..9e66911 100644 --- a/php81/php_zip.stub.php +++ b/php81/php_zip.stub.php @@ -7,64 +7,64 @@ /** * @return resource|int|false - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::open() instead')] function zip_open(string $filename) {} /** * @param resource $zip - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::close() instead')] function zip_close($zip): void {} /** * @param resource $zip * @return resource|false - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::statIndex() instead')] function zip_read($zip) {} /** * @param resource $zip_dp * @param resource $zip_entry - * @deprecated */ +#[\Deprecated(since: '8.0')] function zip_entry_open($zip_dp, $zip_entry, string $mode = "rb"): bool {} /** * @param resource $zip_entry - * @deprecated */ +#[\Deprecated(since: '8.0')] function zip_entry_close($zip_entry): bool {} /** * @param resource $zip_entry - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::getFromIndex() instead')] function zip_entry_read($zip_entry, int $len = 1024): string|false {} /** * @param resource $zip_entry - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::statIndex() instead')] function zip_entry_name($zip_entry): string|false {} /** * @param resource $zip_entry - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::statIndex() instead')] function zip_entry_compressedsize($zip_entry): int|false {} /** * @param resource $zip_entry - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::statIndex() instead')] function zip_entry_filesize($zip_entry): int|false {} /** * @param resource $zip_entry - * @deprecated */ +#[\Deprecated(since: '8.0', message: 'use ZipArchive::statIndex() instead')] function zip_entry_compressionmethod($zip_entry): string|false {} class ZipArchive implements Countable @@ -112,8 +112,8 @@ class ZipArchive implements Countable #ifdef ZIP_FL_RECOMPRESS /** * @cvalue ZIP_FL_RECOMPRESS - * @deprecated */ + #[\Deprecated(since: '8.3')] public const int FL_RECOMPRESS = UNKNOWN; #endif /** diff --git a/php81/php_zip_arginfo.h b/php81/php_zip_arginfo.h index ce0807e..a8a416d 100644 --- a/php81/php_zip_arginfo.h +++ b/php81/php_zip_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 34c92091053addd2aeb353e454fb390509fa4056 */ + * Stub hash: 19fff6630ebc1a64a03d07f76f16cc775fa7fe6d */ ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -144,9 +144,7 @@ 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 -#if defined(HAVE_SET_MTIME) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setMtimeName, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) @@ -235,27 +233,21 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setEx ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_END_ARG_INFO() -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setExternalAttributesIndex, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, opsys, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_END_ARG_INFO() -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_getExternalAttributesName, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_INFO(1, opsys) ZEND_ARG_INFO(1, attr) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_END_ARG_INFO() -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_getExternalAttributesIndex, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_ARG_INFO(1, opsys) @@ -282,9 +274,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setEn ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -#endif -#if defined(HAVE_ENCRYPTION) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_setEncryptionIndex, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0) @@ -310,13 +300,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ZipArchive_isCompressionMe ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enc, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() -#endif -#if defined(HAVE_METHOD_SUPPORTED) #define arginfo_class_ZipArchive_isEncryptionMethodSupported arginfo_class_ZipArchive_isCompressionMethodSupported #endif - ZEND_FUNCTION(zip_open); ZEND_FUNCTION(zip_close); ZEND_FUNCTION(zip_read); @@ -349,8 +336,6 @@ ZEND_METHOD(ZipArchive, setCommentIndex); ZEND_METHOD(ZipArchive, setCommentName); #if defined(HAVE_SET_MTIME) ZEND_METHOD(ZipArchive, setMtimeIndex); -#endif -#if defined(HAVE_SET_MTIME) ZEND_METHOD(ZipArchive, setMtimeName); #endif ZEND_METHOD(ZipArchive, getCommentIndex); @@ -373,22 +358,14 @@ ZEND_METHOD(ZipArchive, getStreamName); ZEND_METHOD(ZipArchive, getStream); #if defined(ZIP_OPSYS_DEFAULT) ZEND_METHOD(ZipArchive, setExternalAttributesName); -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_METHOD(ZipArchive, setExternalAttributesIndex); -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_METHOD(ZipArchive, getExternalAttributesName); -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_METHOD(ZipArchive, getExternalAttributesIndex); #endif ZEND_METHOD(ZipArchive, setCompressionName); ZEND_METHOD(ZipArchive, setCompressionIndex); #if defined(HAVE_ENCRYPTION) ZEND_METHOD(ZipArchive, setEncryptionName); -#endif -#if defined(HAVE_ENCRYPTION) ZEND_METHOD(ZipArchive, setEncryptionIndex); #endif #if defined(HAVE_PROGRESS_CALLBACK) @@ -399,27 +376,63 @@ ZEND_METHOD(ZipArchive, registerCancelCallback); #endif #if defined(HAVE_METHOD_SUPPORTED) ZEND_METHOD(ZipArchive, isCompressionMethodSupported); -#endif -#if defined(HAVE_METHOD_SUPPORTED) ZEND_METHOD(ZipArchive, isEncryptionMethodSupported); #endif - static const zend_function_entry ext_functions[] = { - ZEND_DEP_FE(zip_open, arginfo_zip_open) - ZEND_DEP_FE(zip_close, arginfo_zip_close) - ZEND_DEP_FE(zip_read, arginfo_zip_read) - ZEND_DEP_FE(zip_entry_open, arginfo_zip_entry_open) - ZEND_DEP_FE(zip_entry_close, arginfo_zip_entry_close) - ZEND_DEP_FE(zip_entry_read, arginfo_zip_entry_read) - ZEND_DEP_FE(zip_entry_name, arginfo_zip_entry_name) - ZEND_DEP_FE(zip_entry_compressedsize, arginfo_zip_entry_compressedsize) - ZEND_DEP_FE(zip_entry_filesize, arginfo_zip_entry_filesize) - ZEND_DEP_FE(zip_entry_compressionmethod, arginfo_zip_entry_compressionmethod) +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_open", zif_zip_open, arginfo_zip_open, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_open", zif_zip_open, arginfo_zip_open, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_close", zif_zip_close, arginfo_zip_close, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_close", zif_zip_close, arginfo_zip_close, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_read", zif_zip_read, arginfo_zip_read, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_read", zif_zip_read, arginfo_zip_read, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_entry_open", zif_zip_entry_open, arginfo_zip_entry_open, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_entry_open", zif_zip_entry_open, arginfo_zip_entry_open, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_entry_close", zif_zip_entry_close, arginfo_zip_entry_close, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_entry_close", zif_zip_entry_close, arginfo_zip_entry_close, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_entry_read", zif_zip_entry_read, arginfo_zip_entry_read, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_entry_read", zif_zip_entry_read, arginfo_zip_entry_read, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_entry_name", zif_zip_entry_name, arginfo_zip_entry_name, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_entry_name", zif_zip_entry_name, arginfo_zip_entry_name, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_entry_compressedsize", zif_zip_entry_compressedsize, arginfo_zip_entry_compressedsize, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_entry_compressedsize", zif_zip_entry_compressedsize, arginfo_zip_entry_compressedsize, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_entry_filesize", zif_zip_entry_filesize, arginfo_zip_entry_filesize, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_entry_filesize", zif_zip_entry_filesize, arginfo_zip_entry_filesize, ZEND_ACC_DEPRECATED) +#endif +#if (PHP_VERSION_ID >= 80400) + ZEND_RAW_FENTRY("zip_entry_compressionmethod", zif_zip_entry_compressionmethod, arginfo_zip_entry_compressionmethod, ZEND_ACC_DEPRECATED, NULL, NULL) +#else + ZEND_RAW_FENTRY("zip_entry_compressionmethod", zif_zip_entry_compressionmethod, arginfo_zip_entry_compressionmethod, ZEND_ACC_DEPRECATED) +#endif ZEND_FE_END }; - static const zend_function_entry class_ZipArchive_methods[] = { ZEND_ME(ZipArchive, open, arginfo_class_ZipArchive_open, ZEND_ACC_PUBLIC) ZEND_ME(ZipArchive, setPassword, arginfo_class_ZipArchive_setPassword, ZEND_ACC_PUBLIC) @@ -443,8 +456,6 @@ static const zend_function_entry class_ZipArchive_methods[] = { 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) -#endif -#if defined(HAVE_SET_MTIME) ZEND_ME(ZipArchive, setMtimeName, arginfo_class_ZipArchive_setMtimeName, ZEND_ACC_PUBLIC) #endif ZEND_ME(ZipArchive, getCommentIndex, arginfo_class_ZipArchive_getCommentIndex, ZEND_ACC_PUBLIC) @@ -467,22 +478,14 @@ static const zend_function_entry class_ZipArchive_methods[] = { ZEND_ME(ZipArchive, getStream, arginfo_class_ZipArchive_getStream, ZEND_ACC_PUBLIC) #if defined(ZIP_OPSYS_DEFAULT) ZEND_ME(ZipArchive, setExternalAttributesName, arginfo_class_ZipArchive_setExternalAttributesName, ZEND_ACC_PUBLIC) -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_ME(ZipArchive, setExternalAttributesIndex, arginfo_class_ZipArchive_setExternalAttributesIndex, ZEND_ACC_PUBLIC) -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_ME(ZipArchive, getExternalAttributesName, arginfo_class_ZipArchive_getExternalAttributesName, ZEND_ACC_PUBLIC) -#endif -#if defined(ZIP_OPSYS_DEFAULT) ZEND_ME(ZipArchive, getExternalAttributesIndex, arginfo_class_ZipArchive_getExternalAttributesIndex, ZEND_ACC_PUBLIC) #endif ZEND_ME(ZipArchive, setCompressionName, arginfo_class_ZipArchive_setCompressionName, ZEND_ACC_PUBLIC) ZEND_ME(ZipArchive, setCompressionIndex, arginfo_class_ZipArchive_setCompressionIndex, ZEND_ACC_PUBLIC) #if defined(HAVE_ENCRYPTION) ZEND_ME(ZipArchive, setEncryptionName, arginfo_class_ZipArchive_setEncryptionName, ZEND_ACC_PUBLIC) -#endif -#if defined(HAVE_ENCRYPTION) ZEND_ME(ZipArchive, setEncryptionIndex, arginfo_class_ZipArchive_setEncryptionIndex, ZEND_ACC_PUBLIC) #endif #if defined(HAVE_PROGRESS_CALLBACK) @@ -493,19 +496,155 @@ static const zend_function_entry class_ZipArchive_methods[] = { #endif #if defined(HAVE_METHOD_SUPPORTED) ZEND_ME(ZipArchive, isCompressionMethodSupported, arginfo_class_ZipArchive_isCompressionMethodSupported, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if defined(HAVE_METHOD_SUPPORTED) ZEND_ME(ZipArchive, isEncryptionMethodSupported, arginfo_class_ZipArchive_isEncryptionMethodSupported, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) #endif ZEND_FE_END }; +static void register_php_zip_symbols(int module_number) +{ + + zend_string *attribute_name_Deprecated_func_zip_open_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_open_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_open", sizeof("zip_open") - 1), attribute_name_Deprecated_func_zip_open_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_open_0); + zval attribute_Deprecated_func_zip_open_0_arg0; + zend_string *attribute_Deprecated_func_zip_open_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_open_0_arg0, attribute_Deprecated_func_zip_open_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_open_0->args[0].value, &attribute_Deprecated_func_zip_open_0_arg0); + attribute_Deprecated_func_zip_open_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_open_0_arg1; + zend_string *attribute_Deprecated_func_zip_open_0_arg1_str = zend_string_init("use ZipArchive::open() instead", strlen("use ZipArchive::open() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_open_0_arg1, attribute_Deprecated_func_zip_open_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_open_0->args[1].value, &attribute_Deprecated_func_zip_open_0_arg1); + attribute_Deprecated_func_zip_open_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_string *attribute_name_Deprecated_func_zip_close_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_close_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_close", sizeof("zip_close") - 1), attribute_name_Deprecated_func_zip_close_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_close_0); + zval attribute_Deprecated_func_zip_close_0_arg0; + zend_string *attribute_Deprecated_func_zip_close_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_close_0_arg0, attribute_Deprecated_func_zip_close_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_close_0->args[0].value, &attribute_Deprecated_func_zip_close_0_arg0); + attribute_Deprecated_func_zip_close_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_close_0_arg1; + zend_string *attribute_Deprecated_func_zip_close_0_arg1_str = zend_string_init("use ZipArchive::close() instead", strlen("use ZipArchive::close() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_close_0_arg1, attribute_Deprecated_func_zip_close_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_close_0->args[1].value, &attribute_Deprecated_func_zip_close_0_arg1); + attribute_Deprecated_func_zip_close_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_string *attribute_name_Deprecated_func_zip_read_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_read_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_read", sizeof("zip_read") - 1), attribute_name_Deprecated_func_zip_read_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_read_0); + zval attribute_Deprecated_func_zip_read_0_arg0; + zend_string *attribute_Deprecated_func_zip_read_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_read_0_arg0, attribute_Deprecated_func_zip_read_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_read_0->args[0].value, &attribute_Deprecated_func_zip_read_0_arg0); + attribute_Deprecated_func_zip_read_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_read_0_arg1; + zend_string *attribute_Deprecated_func_zip_read_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_read_0_arg1, attribute_Deprecated_func_zip_read_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_read_0->args[1].value, &attribute_Deprecated_func_zip_read_0_arg1); + attribute_Deprecated_func_zip_read_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_string *attribute_name_Deprecated_func_zip_entry_open_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_entry_open_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_open", sizeof("zip_entry_open") - 1), attribute_name_Deprecated_func_zip_entry_open_0, 1); + zend_string_release(attribute_name_Deprecated_func_zip_entry_open_0); + zval attribute_Deprecated_func_zip_entry_open_0_arg0; + zend_string *attribute_Deprecated_func_zip_entry_open_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_open_0_arg0, attribute_Deprecated_func_zip_entry_open_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_open_0->args[0].value, &attribute_Deprecated_func_zip_entry_open_0_arg0); + attribute_Deprecated_func_zip_entry_open_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + + zend_string *attribute_name_Deprecated_func_zip_entry_close_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_entry_close_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_close", sizeof("zip_entry_close") - 1), attribute_name_Deprecated_func_zip_entry_close_0, 1); + zend_string_release(attribute_name_Deprecated_func_zip_entry_close_0); + zval attribute_Deprecated_func_zip_entry_close_0_arg0; + zend_string *attribute_Deprecated_func_zip_entry_close_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_close_0_arg0, attribute_Deprecated_func_zip_entry_close_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_close_0->args[0].value, &attribute_Deprecated_func_zip_entry_close_0_arg0); + attribute_Deprecated_func_zip_entry_close_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + + zend_string *attribute_name_Deprecated_func_zip_entry_read_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_entry_read_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_read", sizeof("zip_entry_read") - 1), attribute_name_Deprecated_func_zip_entry_read_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_entry_read_0); + zval attribute_Deprecated_func_zip_entry_read_0_arg0; + zend_string *attribute_Deprecated_func_zip_entry_read_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_read_0_arg0, attribute_Deprecated_func_zip_entry_read_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_read_0->args[0].value, &attribute_Deprecated_func_zip_entry_read_0_arg0); + attribute_Deprecated_func_zip_entry_read_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_entry_read_0_arg1; + zend_string *attribute_Deprecated_func_zip_entry_read_0_arg1_str = zend_string_init("use ZipArchive::getFromIndex() instead", strlen("use ZipArchive::getFromIndex() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_read_0_arg1, attribute_Deprecated_func_zip_entry_read_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_read_0->args[1].value, &attribute_Deprecated_func_zip_entry_read_0_arg1); + attribute_Deprecated_func_zip_entry_read_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_string *attribute_name_Deprecated_func_zip_entry_name_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_entry_name_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_name", sizeof("zip_entry_name") - 1), attribute_name_Deprecated_func_zip_entry_name_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_entry_name_0); + zval attribute_Deprecated_func_zip_entry_name_0_arg0; + zend_string *attribute_Deprecated_func_zip_entry_name_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_name_0_arg0, attribute_Deprecated_func_zip_entry_name_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_name_0->args[0].value, &attribute_Deprecated_func_zip_entry_name_0_arg0); + attribute_Deprecated_func_zip_entry_name_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_entry_name_0_arg1; + zend_string *attribute_Deprecated_func_zip_entry_name_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_name_0_arg1, attribute_Deprecated_func_zip_entry_name_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_name_0->args[1].value, &attribute_Deprecated_func_zip_entry_name_0_arg1); + attribute_Deprecated_func_zip_entry_name_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_string *attribute_name_Deprecated_func_zip_entry_compressedsize_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_entry_compressedsize_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_compressedsize", sizeof("zip_entry_compressedsize") - 1), attribute_name_Deprecated_func_zip_entry_compressedsize_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_entry_compressedsize_0); + zval attribute_Deprecated_func_zip_entry_compressedsize_0_arg0; + zend_string *attribute_Deprecated_func_zip_entry_compressedsize_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressedsize_0_arg0, attribute_Deprecated_func_zip_entry_compressedsize_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressedsize_0->args[0].value, &attribute_Deprecated_func_zip_entry_compressedsize_0_arg0); + attribute_Deprecated_func_zip_entry_compressedsize_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_entry_compressedsize_0_arg1; + zend_string *attribute_Deprecated_func_zip_entry_compressedsize_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressedsize_0_arg1, attribute_Deprecated_func_zip_entry_compressedsize_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressedsize_0->args[1].value, &attribute_Deprecated_func_zip_entry_compressedsize_0_arg1); + attribute_Deprecated_func_zip_entry_compressedsize_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_string *attribute_name_Deprecated_func_zip_entry_filesize_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_entry_filesize_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_filesize", sizeof("zip_entry_filesize") - 1), attribute_name_Deprecated_func_zip_entry_filesize_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_entry_filesize_0); + zval attribute_Deprecated_func_zip_entry_filesize_0_arg0; + zend_string *attribute_Deprecated_func_zip_entry_filesize_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_filesize_0_arg0, attribute_Deprecated_func_zip_entry_filesize_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_filesize_0->args[0].value, &attribute_Deprecated_func_zip_entry_filesize_0_arg0); + attribute_Deprecated_func_zip_entry_filesize_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_entry_filesize_0_arg1; + zend_string *attribute_Deprecated_func_zip_entry_filesize_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_filesize_0_arg1, attribute_Deprecated_func_zip_entry_filesize_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_filesize_0->args[1].value, &attribute_Deprecated_func_zip_entry_filesize_0_arg1); + attribute_Deprecated_func_zip_entry_filesize_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_string *attribute_name_Deprecated_func_zip_entry_compressionmethod_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_func_zip_entry_compressionmethod_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_compressionmethod", sizeof("zip_entry_compressionmethod") - 1), attribute_name_Deprecated_func_zip_entry_compressionmethod_0, 2); + zend_string_release(attribute_name_Deprecated_func_zip_entry_compressionmethod_0); + zval attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0; + zend_string *attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0, attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressionmethod_0->args[0].value, &attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0); + attribute_Deprecated_func_zip_entry_compressionmethod_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); + zval attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1; + zend_string *attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); + ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1, attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressionmethod_0->args[1].value, &attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1); + attribute_Deprecated_func_zip_entry_compressionmethod_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); +} + static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry_Countable) { zend_class_entry ce, *class_entry; INIT_CLASS_ENTRY(ce, "ZipArchive", class_ZipArchive_methods); +#if (PHP_VERSION_ID >= 80400) + class_entry = zend_register_internal_class_with_flags(&ce, NULL, 0); +#else class_entry = zend_register_internal_class_ex(&ce, NULL); +#endif zend_class_implements(class_entry, 1, class_entry_Countable); zval const_CREATE_value; @@ -605,9 +744,9 @@ static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry ZVAL_LONG(&const_FL_RECOMPRESS_value, ZIP_FL_RECOMPRESS); zend_string *const_FL_RECOMPRESS_name = zend_string_init_interned("FL_RECOMPRESS", sizeof("FL_RECOMPRESS") - 1, 1); #if (PHP_VERSION_ID >= 80300) - zend_declare_typed_class_constant(class_entry, const_FL_RECOMPRESS_name, &const_FL_RECOMPRESS_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); + zend_class_constant *const_FL_RECOMPRESS = zend_declare_typed_class_constant(class_entry, const_FL_RECOMPRESS_name, &const_FL_RECOMPRESS_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); #else - zend_declare_class_constant_ex(class_entry, const_FL_RECOMPRESS_name, &const_FL_RECOMPRESS_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL); + zend_class_constant *const_FL_RECOMPRESS = zend_declare_class_constant_ex(class_entry, const_FL_RECOMPRESS_name, &const_FL_RECOMPRESS_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL); #endif zend_string_release(const_FL_RECOMPRESS_name); #endif @@ -1729,6 +1868,18 @@ static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry zend_declare_typed_property(class_entry, property_comment_name, &property_comment_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING)); zend_string_release(property_comment_name); +#if defined(ZIP_FL_RECOMPRESS) + + zend_string *attribute_name_Deprecated_const_FL_RECOMPRESS_0 = zend_string_init_interned("Deprecated", sizeof("Deprecated") - 1, 1); + zend_attribute *attribute_Deprecated_const_FL_RECOMPRESS_0 = zend_add_class_constant_attribute(class_entry, const_FL_RECOMPRESS, attribute_name_Deprecated_const_FL_RECOMPRESS_0, 1); + zend_string_release(attribute_name_Deprecated_const_FL_RECOMPRESS_0); + zval attribute_Deprecated_const_FL_RECOMPRESS_0_arg0; + zend_string *attribute_Deprecated_const_FL_RECOMPRESS_0_arg0_str = zend_string_init("8.3", strlen("8.3"), 1); + ZVAL_STR(&attribute_Deprecated_const_FL_RECOMPRESS_0_arg0, attribute_Deprecated_const_FL_RECOMPRESS_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_const_FL_RECOMPRESS_0->args[0].value, &attribute_Deprecated_const_FL_RECOMPRESS_0_arg0); + attribute_Deprecated_const_FL_RECOMPRESS_0->args[0].name = zend_string_init_interned("since", sizeof("since") - 1, 1); +#endif + zend_string *attribute_name_SensitiveParameter_func_setpassword_arg0_0 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setpassword", sizeof("setpassword") - 1), 0, attribute_name_SensitiveParameter_func_setpassword_arg0_0, 0); @@ -1738,8 +1889,6 @@ static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry zend_string *attribute_name_SensitiveParameter_func_setencryptionname_arg2_0 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setencryptionname", sizeof("setencryptionname") - 1), 2, attribute_name_SensitiveParameter_func_setencryptionname_arg2_0, 0); zend_string_release(attribute_name_SensitiveParameter_func_setencryptionname_arg2_0); -#endif -#if defined(HAVE_ENCRYPTION) zend_string *attribute_name_SensitiveParameter_func_setencryptionindex_arg2_0 = zend_string_init_interned("SensitiveParameter", sizeof("SensitiveParameter") - 1, 1); zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setencryptionindex", sizeof("setencryptionindex") - 1), 2, attribute_name_SensitiveParameter_func_setencryptionindex_arg2_0, 0); diff --git a/php81/zip_stream.c b/php81/zip_stream.c index 28c363e..a323243 100644 --- a/php81/zip_stream.c +++ b/php81/zip_stream.c @@ -26,8 +26,6 @@ #include "fopen_wrappers.h" #include "php_zip.h" -#include "ext/standard/url.h" - /* needed for ssize_t definition */ #include diff --git a/tests/oo_getcomment2.phpt b/tests/oo_getcomment2.phpt index 113c6b6..273113e 100644 --- a/tests/oo_getcomment2.phpt +++ b/tests/oo_getcomment2.phpt @@ -29,8 +29,8 @@ try { $zip->close(); ?> ---EXPECT-- +--EXPECTF-- Zip archive comment string(11) "foo comment" string(11) "foo comment" -ZipArchive::getCommentName(): Argument #1 ($name) cannot be empty +ZipArchive::getCommentName(): Argument #1 ($name) %s be empty diff --git a/tests/oo_open2.phpt b/tests/oo_open2.phpt index 337b8c6..48f55c3 100644 --- a/tests/oo_open2.phpt +++ b/tests/oo_open2.phpt @@ -42,8 +42,8 @@ if ($zip->status == ZIPARCHIVE::ER_OK) { echo "failed\n"; } ?> ---EXPECT-- +--EXPECTF-- ER_OPEN: ok create: ok -ZipArchive::open(): Argument #1 ($filename) cannot be empty +ZipArchive::open(): Argument #1 ($filename) %s be empty OK diff --git a/tests/zip_open_error2.phpt b/tests/zip_open_error2.phpt index 01e0e20..697541b 100644 --- a/tests/zip_open_error2.phpt +++ b/tests/zip_open_error2.phpt @@ -23,9 +23,9 @@ echo is_resource($zip) ? "OK" : "Failure"; ?> --EXPECTF-- Test case 1: -Deprecated: Function zip_open() is deprecated in %s on line %d -zip_open(): Argument #1 ($filename) cannot be empty +Deprecated: Function zip_open() is deprecated %s on line %d +zip_open(): Argument #1 ($filename) %s be empty Test case 2: -Deprecated: Function zip_open() is deprecated in %s on line %d +Deprecated: Function zip_open() is deprecated %s on line %d Failure