summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c276
1 files changed, 55 insertions, 221 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 4fedabad1c..02b8b6c49e 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -619,7 +619,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
{
#ifdef ZTS
char cwd[MAXPATHLEN];
- int cwd_skip = 0;
char work_path[MAXPATHLEN];
char *result;
#endif
@@ -638,8 +637,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
cwd[2] = '\0';
}
#endif
- cwd_skip = strlen(cwd)+1;
-
snprintf(work_path, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, path);
path = work_path;
}
@@ -654,10 +651,10 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
if (files_cnt > 0) {
pcre2_code *re = NULL;
pcre2_match_data *match_data = NULL;
- uint32_t preg_options = 0, i, capture_count;
+ uint32_t i, capture_count;
int rc;
- re = pcre_get_compiled_regex(regexp, &capture_count, &preg_options);
+ re = pcre_get_compiled_regex(regexp, &capture_count);
if (!re) {
php_error_docref(NULL, E_WARNING, "Invalid expression");
return -1;
@@ -703,7 +700,7 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
zend_string_release_ex(namelist[i], 0);
continue;
}
- rc = pcre2_match(re, (PCRE2_SPTR)ZSTR_VAL(namelist[i]), ZSTR_LEN(namelist[i]), 0, preg_options, match_data, mctx);
+ rc = pcre2_match(re, (PCRE2_SPTR)ZSTR_VAL(namelist[i]), ZSTR_LEN(namelist[i]), 0, 0, match_data, mctx);
php_pcre_free_match_data(match_data);
/* 0 means that the vector is too small to hold all the captured substring offsets */
if (rc < 0) {
@@ -1030,7 +1027,7 @@ static void php_zip_object_free_storage(zend_object *object) /* {{{ */
if (intern->za) {
if (zip_close(intern->za) != 0) {
#if LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR == 3 && LIBZIP_VERSION_MICRO == 1
- php_error_docref(NULL, E_WARNING, "Cannot destroy the zip context: %s", "zip_close have failed");
+ php_error_docref(NULL, E_WARNING, "Cannot destroy the zip context: zip_close have failed");
#else
php_error_docref(NULL, E_WARNING, "Cannot destroy the zip context: %s", zip_strerror(intern->za));
zip_discard(intern->za);
@@ -1441,17 +1438,15 @@ static ZIPARCHIVE_METHOD(open)
zend_long flags = 0;
char *resolved_path;
zend_string *filename;
- zval *self = getThis();
- ze_zip_object *ze_obj = NULL;
+ zval *self = ZEND_THIS;
+ ze_zip_object *ze_obj;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &filename, &flags) == FAILURE) {
return;
}
- if (self) {
- /* We do not use ZIP_FROM_OBJECT, zip init function here */
- ze_obj = Z_ZIP_P(self);
- }
+ /* We do not use ZIP_FROM_OBJECT, zip init function here */
+ ze_obj = Z_ZIP_P(self);
if (ZSTR_LEN(filename) == 0) {
php_error_docref(NULL, E_WARNING, "Empty string as source");
@@ -1497,14 +1492,10 @@ Set the password for the active archive */
static ZIPARCHIVE_METHOD(setPassword)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
char *password;
size_t password_len;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &password, &password_len) == FAILURE) {
@@ -1529,21 +1520,17 @@ close the zip archive */
static ZIPARCHIVE_METHOD(close)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
ze_zip_object *ze_obj;
int err;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
ze_obj = Z_ZIP_P(self);
if ((err = zip_close(intern))) {
#if LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR == 3 && LIBZIP_VERSION_MICRO == 1
- php_error_docref(NULL, E_WARNING, "%s", "zip_close have failed");
+ php_error_docref(NULL, E_WARNING, "zip_close have failed");
#else
php_error_docref(NULL, E_WARNING, "%s", zip_strerror(intern));
zip_discard(intern);
@@ -1568,11 +1555,7 @@ close the zip archive */
static ZIPARCHIVE_METHOD(count)
{
struct zip *intern;
- zval *self = getThis();
-
- if (!self) {
- RETURN_FALSE;
- }
+ zval *self = ZEND_THIS;
ZIP_FROM_OBJECT(intern, self);
@@ -1585,7 +1568,7 @@ static ZIPARCHIVE_METHOD(count)
static ZIPARCHIVE_METHOD(getStatusString)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
#if LIBZIP_VERSION_MAJOR < 1
int zep, syp, len;
char error_string[128];
@@ -1593,10 +1576,6 @@ static ZIPARCHIVE_METHOD(getStatusString)
zip_error_t *err;
#endif
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
#if LIBZIP_VERSION_MAJOR < 1
@@ -1617,17 +1596,13 @@ Returns the index of the entry named filename in the archive */
static ZIPARCHIVE_METHOD(addEmptyDir)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
char *dirname;
size_t dirname_len;
int idx;
struct zip_stat sb;
char *s;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
@@ -1668,7 +1643,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
char *path = ".";
char *remove_path = NULL;
char *add_path = NULL;
@@ -1679,10 +1654,6 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
int found;
zend_string *pattern;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
/* 1 == glob, 2 == pcre */
if (type == 1) {
@@ -1793,16 +1764,12 @@ Add a file in a Zip archive using its path and the name to use. */
static ZIPARCHIVE_METHOD(addFile)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
char *entry_name = NULL;
size_t entry_name_len = 0;
zend_long offset_start = 0, offset_len = 0;
zend_string *filename;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|sll",
@@ -1833,7 +1800,7 @@ Add a file using content and the entry name */
static ZIPARCHIVE_METHOD(addFromString)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_string *buffer;
char *name;
size_t name_len;
@@ -1842,10 +1809,6 @@ static ZIPARCHIVE_METHOD(addFromString)
int pos = 0;
int cur_idx;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS",
@@ -1895,15 +1858,11 @@ Returns the information about a the zip entry filename */
static ZIPARCHIVE_METHOD(statName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long flags = 0;
struct zip_stat sb;
zend_string *name;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
@@ -1917,19 +1876,15 @@ static ZIPARCHIVE_METHOD(statName)
/* }}} */
/* {{{ proto resource ZipArchive::statIndex(int index[, int flags])
-Returns the zip entry informations using its index */
+Returns the zip entry information using its index */
static ZIPARCHIVE_METHOD(statIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long index, flags = 0;
struct zip_stat sb;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
@@ -1949,15 +1904,11 @@ Returns the index of the entry named filename in the archive */
static ZIPARCHIVE_METHOD(locateName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long flags = 0;
zend_long idx = -1;
zend_string *name;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
@@ -1983,14 +1934,10 @@ Returns the name of the file at position index */
static ZIPARCHIVE_METHOD(getNameIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
const char *name;
zend_long flags = 0, index = 0;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
@@ -2013,14 +1960,10 @@ Set or remove (NULL/'') the comment of the archive */
static ZIPARCHIVE_METHOD(setArchiveComment)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
size_t comment_len;
char * comment;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &comment, &comment_len) == FAILURE) {
@@ -2039,15 +1982,11 @@ Returns the comment of an entry using its index */
static ZIPARCHIVE_METHOD(getArchiveComment)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long flags = 0;
const char * comment;
int comment_len = 0;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
@@ -2067,15 +2006,11 @@ Set or remove (NULL/'') the comment of an entry using its Name */
static ZIPARCHIVE_METHOD(setCommentName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
size_t comment_len, name_len;
char * comment, *name;
int idx;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
@@ -2100,16 +2035,12 @@ Set or remove (NULL/'') the comment of an entry using its index */
static ZIPARCHIVE_METHOD(setCommentIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long index;
size_t comment_len;
char * comment;
struct zip_stat sb;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls",
@@ -2130,16 +2061,12 @@ Set external attributes for file in zip, using its name */
static ZIPARCHIVE_METHOD(setExternalAttributesName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
size_t name_len;
char *name;
zend_long flags=0, opsys, attr;
zip_int64_t idx;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll|l",
@@ -2168,14 +2095,10 @@ Set external attributes for file in zip, using its index */
static ZIPARCHIVE_METHOD(setExternalAttributesIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long index, flags=0, opsys, attr;
struct zip_stat sb;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll|l",
@@ -2197,7 +2120,7 @@ Get external attributes for file in zip, using its name */
static ZIPARCHIVE_METHOD(getExternalAttributesName)
{
struct zip *intern;
- zval *self = getThis(), *z_opsys, *z_attr;
+ zval *self = ZEND_THIS, *z_opsys, *z_attr;
size_t name_len;
char *name;
zend_long flags=0;
@@ -2205,13 +2128,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName)
zip_uint32_t attr;
zip_int64_t idx;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz/z/|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l",
&name, &name_len, &z_opsys, &z_attr, &flags) == FAILURE) {
return;
}
@@ -2228,10 +2147,8 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName)
(zip_flags_t)flags, &opsys, &attr) < 0) {
RETURN_FALSE;
}
- zval_ptr_dtor(z_opsys);
- ZVAL_LONG(z_opsys, opsys);
- zval_ptr_dtor(z_attr);
- ZVAL_LONG(z_attr, attr);
+ ZEND_TRY_ASSIGN_LONG(z_opsys, opsys);
+ ZEND_TRY_ASSIGN_LONG(z_attr, attr);
RETURN_TRUE;
}
/* }}} */
@@ -2241,19 +2158,15 @@ Get external attributes for file in zip, using its index */
static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
{
struct zip *intern;
- zval *self = getThis(), *z_opsys, *z_attr;
+ zval *self = ZEND_THIS, *z_opsys, *z_attr;
zend_long index, flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
struct zip_stat sb;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/z/|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lzz|l",
&index, &z_opsys, &z_attr, &flags) == FAILURE) {
return;
}
@@ -2263,10 +2176,8 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
(zip_flags_t)flags, &opsys, &attr) < 0) {
RETURN_FALSE;
}
- zval_ptr_dtor(z_opsys);
- ZVAL_LONG(z_opsys, opsys);
- zval_ptr_dtor(z_attr);
- ZVAL_LONG(z_attr, attr);
+ ZEND_TRY_ASSIGN_LONG(z_opsys, opsys);
+ ZEND_TRY_ASSIGN_LONG(z_attr, attr);
RETURN_TRUE;
}
/* }}} */
@@ -2278,16 +2189,12 @@ Set encryption method for file in zip, using its name */
static ZIPARCHIVE_METHOD(setEncryptionName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long method;
zip_int64_t idx;
char *name, *password = NULL;
size_t name_len, password_len;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|s",
@@ -2316,15 +2223,11 @@ Set encryption method for file in zip, using its index */
static ZIPARCHIVE_METHOD(setEncryptionIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long index, method;
char *password = NULL;
size_t password_len;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|s",
@@ -2345,7 +2248,7 @@ Returns the comment of an entry using its name */
static ZIPARCHIVE_METHOD(getCommentName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
size_t name_len;
int idx;
zend_long flags = 0;
@@ -2353,10 +2256,6 @@ static ZIPARCHIVE_METHOD(getCommentName)
const char * comment;
char *name;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
@@ -2383,16 +2282,12 @@ Returns the comment of an entry using its index */
static ZIPARCHIVE_METHOD(getCommentIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long index, flags = 0;
const char * comment;
int comment_len = 0;
struct zip_stat sb;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
@@ -2411,16 +2306,12 @@ Set the compression of a file in zip, using its name */
static ZIPARCHIVE_METHOD(setCompressionName)
{
struct zip *intern;
- zval *this = getThis();
+ zval *this = ZEND_THIS;
size_t name_len;
char *name;
zip_int64_t idx;
zend_long comp_method, comp_flags = 0;
- if (!this) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, this);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l",
@@ -2450,14 +2341,10 @@ Set the compression of a file in zip, using its index */
static ZIPARCHIVE_METHOD(setCompressionIndex)
{
struct zip *intern;
- zval *this = getThis();
+ zval *this = ZEND_THIS;
zend_long index;
zend_long comp_method, comp_flags = 0;
- if (!this) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, this);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l",
@@ -2478,13 +2365,9 @@ Delete a file using its index */
static ZIPARCHIVE_METHOD(deleteIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long index;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
@@ -2508,15 +2391,11 @@ Delete a file using its index */
static ZIPARCHIVE_METHOD(deleteName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
size_t name_len;
char *name;
struct zip_stat sb;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
@@ -2539,15 +2418,11 @@ Rename an entry selected by its index to new_name */
static ZIPARCHIVE_METHOD(renameIndex)
{
struct zip *intern;
- zval *self = getThis();
-
+ zval *self = ZEND_THIS;
char *new_name;
size_t new_name_len;
zend_long index;
- if (!self) {
- RETURN_FALSE;
- }
ZIP_FROM_OBJECT(intern, self);
@@ -2575,15 +2450,11 @@ Rename an entry selected by its name to new_name */
static ZIPARCHIVE_METHOD(renameName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
struct zip_stat sb;
char *name, *new_name;
size_t name_len, new_name_len;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &new_name, &new_name_len) == FAILURE) {
@@ -2609,13 +2480,9 @@ Changes to the file at position index are reverted */
static ZIPARCHIVE_METHOD(unchangeIndex)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zend_long index;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
@@ -2639,15 +2506,11 @@ Changes to the file named 'name' are reverted */
static ZIPARCHIVE_METHOD(unchangeName)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
struct zip_stat sb;
char *name;
size_t name_len;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
@@ -2673,11 +2536,7 @@ All changes to files and global information in archive are reverted */
static ZIPARCHIVE_METHOD(unchangeAll)
{
struct zip *intern;
- zval *self = getThis();
-
- if (!self) {
- RETURN_FALSE;
- }
+ zval *self = ZEND_THIS;
ZIP_FROM_OBJECT(intern, self);
@@ -2694,11 +2553,7 @@ Revert all global changes to the archive archive. For now, this only reverts ar
static ZIPARCHIVE_METHOD(unchangeArchive)
{
struct zip *intern;
- zval *self = getThis();
-
- if (!self) {
- RETURN_FALSE;
- }
+ zval *self = ZEND_THIS;
ZIP_FROM_OBJECT(intern, self);
@@ -2713,7 +2568,7 @@ static ZIPARCHIVE_METHOD(unchangeArchive)
/* {{{ proto bool ZipArchive::extractTo(string pathto[, mixed files])
Extract one or more file from a zip archive */
/* TODO:
- * - allow index or array of indeces
+ * - allow index or array of indices
* - replace path
* - patterns
*/
@@ -2721,7 +2576,7 @@ static ZIPARCHIVE_METHOD(extractTo)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
zval *zval_files = NULL;
zval *zval_file = NULL;
php_stream_statbuf ssb;
@@ -2731,10 +2586,6 @@ static ZIPARCHIVE_METHOD(extractTo)
int nelems;
- if (!self) {
- RETURN_FALSE;
- }
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z", &pathto, &pathto_len, &zval_files) == FAILURE) {
return;
}
@@ -2805,7 +2656,7 @@ static ZIPARCHIVE_METHOD(extractTo)
static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
struct zip_stat sb;
struct zip_file *zf;
@@ -2819,10 +2670,6 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
int n = 0;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (type == 1) {
@@ -2889,17 +2736,13 @@ get a stream for an entry using its name */
static ZIPARCHIVE_METHOD(getStream)
{
struct zip *intern;
- zval *self = getThis();
+ zval *self = ZEND_THIS;
struct zip_stat sb;
char *mode = "rb";
zend_string *filename;
php_stream *stream;
ze_zip_object *obj;
- if (!self) {
- RETURN_FALSE;
- }
-
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &filename) == FAILURE) {
@@ -3321,12 +3164,3 @@ static PHP_MINFO_FUNCTION(zip)
php_info_print_table_end();
}
/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */