php_error_docref(NULL, E_NOTICE, "Empty string as pattern");
RETURN_FALSE;
}
+ if (options && zend_hash_num_elements(Z_ARRVAL_P(options)) > 0 && (php_zip_parse_options(options, &opts) < 0)) {
RETURN_FALSE;
}
char *name, *password = NULL;
size_t name_len, password_len;
- ZIP_FROM_OBJECT(intern, self);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|s!",
&name, &name_len, &method, &password, &password_len) == FAILURE) {
RETURN_THROWS();
}
char *password = NULL;
size_t password_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|s!",
&index, &method, &password, &password_len) == FAILURE) {
RETURN_THROWS();
}
- if (zip_file_set_encryption(intern, index, (zip_uint16_t)method, password)) {
ZIP_FROM_OBJECT(intern, self);
+
+ if (zip_file_set_encryption(intern, index, (zip_uint16_t)method, password)) {
RETURN_FALSE;
}
RETURN_TRUE;
size_t pathto_len;
int ret;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z", &pathto, &pathto_len, &zval_files) == FAILURE) {
RETURN_THROWS();
}
}
if (php_stream_stat_path_ex(pathto, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL) < 0) {
- ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL);
- if (!ret) {
- RETURN_FALSE;
- }
+ ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL);
+ if (!ret) {
+ RETURN_FALSE;
+ }
}
if (zval_files && Z_TYPE_P(zval_files) != IS_NULL) {
public function addFromString(string $name, string $content, int $flags = ZipArchive::FL_OVERWRITE) {}
/** @return bool */
- public function addFile(string $filepath, string $entryname = UNKNOWN, int $start = 0, int $length = 0, int $flags = ZipArchive::FL_OVERWRITE) {}
+ public function addFile(string $filepath, string $entryname = "", int $start = 0, int $length = 0, int $flags = ZipArchive::FL_OVERWRITE) {}
/** @return bool */
public function replaceFile(string $filepath, string $index, int $start = 0, int $length = 0, int $flags = 0) {}
/** @return array|false */
- public function addGlob(string $pattern, int $flags = 0, $options = UNKNOWN) {}
+ public function addGlob(string $pattern, int $flags = 0, array $options = []) {}
/** @return array|false */
- public function addPattern(string $pattern, string $path = UNKNOWN, $options = UNKNOWN) {}
+ public function addPattern(string $pattern, string $path = ".", array $options = []) {}
/** @return bool */
public function renameIndex(int $index, string $new_name) {}
public function unchangeName(string $name) {}
/** @return bool */
- public function extractTo(string $pathto, $files = UNKNOWN) {}
+ public function extractTo(string $pathto, $files = null) {}
/** @return string|false */
public function getFromName(string $entryname, int $len = 0, int $flags = 0) {}
#ifdef HAVE_ENCRYPTION
/** @return bool */
- public function setEncryptionName(string $name, int $method, string $password = UNKNOWN) {}
+ public function setEncryptionName(string $name, int $method, ?string $password = null) {}
/** @return bool */
- public function setEncryptionIndex(int $index, int $method, string $password = UNKNOWN) {}
+ public function setEncryptionIndex(int $index, int $method, ?string $password = null) {}
#endif
#ifdef HAVE_PROGRESS_CALLBACK
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addFile, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filepath, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, entryname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, entryname, IS_STRING, 0, "\"\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ZipArchive::FL_OVERWRITE")
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addGlob, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
- ZEND_ARG_INFO(0, options)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addPattern, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
- ZEND_ARG_INFO(0, options)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, path, IS_STRING, 0, "\".\"")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_renameIndex, 0, 0, 2)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_extractTo, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, pathto, IS_STRING, 0)
- ZEND_ARG_INFO(0, files)
+ ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, files, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getFromName, 0, 0, 1)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setEncryptionName, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
- ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setEncryptionIndex, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
- ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#endif