summaryrefslogtreecommitdiff
path: root/ext/phar/util.c
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-08-21 05:17:28 +0000
committerGreg Beaver <cellog@php.net>2008-08-21 05:17:28 +0000
commitc3e8485971f066259672103f143ae6e3fa86f2de (patch)
tree3151be9d89afb45f93875ff6c340401625dd7dcc /ext/phar/util.c
parent50066470cd3e1963c591d40e94f2d0a15117f596 (diff)
downloadphp-git-c3e8485971f066259672103f143ae6e3fa86f2de.tar.gz
fix bug #45792: bz2 compressed files in zip failure
Diffstat (limited to 'ext/phar/util.c')
-rw-r--r--ext/phar/util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 008bd3f5ea..ea5159840d 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -913,6 +913,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
char *filtername;
off_t loc;
php_stream *ufp;
+ phar_entry_data dummy;
if (follow_links && entry->link) {
phar_entry_info *link_entry = phar_get_link_source(entry TSRMLS_CC);
@@ -921,6 +922,10 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
}
}
+ if (entry->is_modified) {
+ return SUCCESS;
+ }
+
if (entry->fp_type == PHAR_TMP) {
if (!entry->fp) {
entry->fp = php_stream_open_wrapper(entry->tmp, "rb", STREAM_MUST_SEEK|0, NULL);
@@ -941,6 +946,13 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
}
if ((entry->old_flags && !(entry->old_flags & PHAR_ENT_COMPRESSION_MASK)) || !(entry->flags & PHAR_ENT_COMPRESSION_MASK)) {
+ dummy.internal_file = entry;
+ dummy.phar = phar;
+ dummy.zero = entry->offset;
+ dummy.fp = phar_get_pharfp(phar TSRMLS_CC);
+ if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1 TSRMLS_CC)) {
+ return FAILURE;
+ }
return SUCCESS;
}
@@ -952,6 +964,14 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
}
}
+ dummy.internal_file = entry;
+ dummy.phar = phar;
+ dummy.zero = entry->offset;
+ dummy.fp = phar_get_pharfp(phar TSRMLS_CC);
+ if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1 TSRMLS_CC)) {
+ return FAILURE;
+ }
+
ufp = phar_get_entrypufp(entry TSRMLS_CC);
if ((filtername = phar_decompress_filter(entry, 0)) != NULL) {
@@ -991,6 +1011,11 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
/* this is now the new location of the file contents within this fp */
phar_set_fp_type(entry, PHAR_UFP, loc TSRMLS_CC);
+ dummy.zero = entry->offset;
+ dummy.fp = ufp;
+ if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 0 TSRMLS_CC)) {
+ return FAILURE;
+ }
return SUCCESS;
}
/* }}} */