diff options
author | Greg Beaver <cellog@php.net> | 2008-08-31 02:14:03 +0000 |
---|---|---|
committer | Greg Beaver <cellog@php.net> | 2008-08-31 02:14:03 +0000 |
commit | 6ac2c92ede46a379415c231d911b3360667a117d (patch) | |
tree | 2eb492728ef271f73ce7e06ccd4e9925a7b64d4c | |
parent | 80f8ad97fb14cd7f0623a5c34b6d6c9cdc4532f4 (diff) | |
download | php-git-6ac2c92ede46a379415c231d911b3360667a117d.tar.gz |
2 fixes, merge minor fixes from pecl/phar. Merge in corrected fix from pecl/phar for is_tar setting of tar_type
-rwxr-xr-x | ext/phar/phar.phar | bin | 14631 -> 14631 bytes | |||
-rw-r--r-- | ext/phar/stream.c | 2 | ||||
-rw-r--r-- | ext/phar/util.c | 22 | ||||
-rw-r--r-- | ext/phar/zip.c | 4 |
4 files changed, 15 insertions, 13 deletions
diff --git a/ext/phar/phar.phar b/ext/phar/phar.phar Binary files differindex 2ee3026cc1..06cbf51a1f 100755 --- a/ext/phar/phar.phar +++ b/ext/phar/phar.phar diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 729847ca2f..e6408ff669 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -910,6 +910,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char memcpy(new_str_key, resource_to->path + 1, to_len); memcpy(new_str_key + to_len, str_key + from_len, key_len - from_len); new_str_key[new_key_len] = 0; + is_modified = 1; entry->is_modified = 1; efree(entry->filename); @@ -917,7 +918,6 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char entry->filename_len = new_key_len; PHAR_ZSTR(new_str_key, new_key); - #if PHP_VERSION_ID < 50300 zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, new_key_len, 0, NULL); #else diff --git a/ext/phar/util.c b/ext/phar/util.c index ea5159840d..12a046b3ba 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -686,7 +686,7 @@ really_get_entry: if (entry->link) { efree(entry->link); entry->link = NULL; - entry->tar_type = (entry->tar_type ? TAR_FILE : 0); + entry->tar_type = (entry->is_tar ? TAR_FILE : 0); } if (for_write) { @@ -740,7 +740,7 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char phar_unixify_path_separators(path, path_len); #endif - is_dir = (path_len > 0 && path != NULL) ? path[path_len - 1] == '/' : 0; + is_dir = (path_len && path[path_len - 1] == '/') ? 1 : 0; if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error TSRMLS_CC)) { return NULL; @@ -877,7 +877,7 @@ int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **er if (dest->link) { efree(dest->link); dest->link = NULL; - dest->tar_type = (dest->tar_type ? TAR_FILE : 0); + dest->tar_type = (dest->is_tar ? TAR_FILE : 0); } dest->fp_type = PHAR_MOD; @@ -1082,7 +1082,7 @@ int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, if (entry->link) { efree(entry->link); entry->link = NULL; - entry->tar_type = (entry->tar_type ? TAR_FILE : 0); + entry->tar_type = (entry->is_tar ? TAR_FILE : 0); } entry->fp = php_stream_fopen_tmpfile(); @@ -1139,7 +1139,7 @@ int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC) /* {{ if (entry->link) { efree(entry->link); entry->link = NULL; - entry->tar_type = (entry->tar_type ? TAR_FILE : 0); + entry->tar_type = (entry->is_tar ? TAR_FILE : 0); } entry->offset = 0; @@ -1459,7 +1459,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in phar_unixify_path_separators(path, path_len); #endif - is_dir = path_len && (path[path_len - 1] == '/'); + is_dir = (path_len && (path[path_len - 1] == '/')) ? 1 : 0; if (error) { *error = NULL; @@ -1550,7 +1550,6 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in } else { char *test; int test_len; - phar_entry_info *entry; php_stream_statbuf ssb; if (SUCCESS != zend_hash_find(&phar->manifest, str_key, keylen, (void **) &entry)) { @@ -1663,6 +1662,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, zval_dtor(zkey); return FAILURE; } + #if PHP_VERSION_ID < 50300 if (FAILURE == zend_fcall_info_init(openssl, &fci, &fcc TSRMLS_CC)) { #else @@ -1680,7 +1680,9 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, fci.params = zp; #if PHP_VERSION_ID < 50300 ++(zdata->refcount); - ++(zsig->refcount); + if (!is_sign) { + ++(zsig->refcount); + } ++(zkey->refcount); #else Z_ADDREF_P(zdata); @@ -1709,7 +1711,9 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, efree(openssl); #if PHP_VERSION_ID < 50300 --(zdata->refcount); - --(zsig->refcount); + if (!is_sign) { + --(zsig->refcount); + } --(zkey->refcount); #else Z_DELREF_P(zdata); diff --git a/ext/phar/zip.c b/ext/phar/zip.c index cd40e22dc5..26d873239f 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -159,7 +159,6 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, phar_zip_dir_end locator; char buf[sizeof(locator) + 65536]; long size; - size_t read; php_uint16 i; phar_archive_data *mydata = NULL; phar_entry_info entry = {0}; @@ -181,7 +180,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, php_stream_seek(fp, 0, SEEK_SET); } - if (!(read = php_stream_read(fp, buf, size))) { + if (!php_stream_read(fp, buf, size)) { php_stream_close(fp); if (error) { spprintf(error, 4096, "phar error: unable to read in data to search for end of central directory in zip-based phar \"%s\"", fname); @@ -491,7 +490,6 @@ foundit: php_stream_filter_remove(filter, 1 TSRMLS_CC); } else if (entry.flags & PHAR_ENT_COMPRESSED_BZ2) { - php_stream_filter *filter; filter = php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp) TSRMLS_CC); if (!filter) { |