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);
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
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) {
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;
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;
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();
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;
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;
} 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)) {
zval_dtor(zkey);
return FAILURE;
}
+
#if PHP_VERSION_ID < 50300
if (FAILURE == zend_fcall_info_init(openssl, &fci, &fcc TSRMLS_CC)) {
#else
fci.params = zp;
#if PHP_VERSION_ID < 50300
++(zdata->refcount);
- ++(zsig->refcount);
+ if (!is_sign) {
+ ++(zsig->refcount);
+ }
++(zkey->refcount);
#else
Z_ADDREF_P(zdata);
efree(openssl);
#if PHP_VERSION_ID < 50300
--(zdata->refcount);
- --(zsig->refcount);
+ if (!is_sign) {
+ --(zsig->refcount);
+ }
--(zkey->refcount);
#else
Z_DELREF_P(zdata);
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};
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);
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) {