From fade22bfd8e6c40de752cc94310eee59658ffbea Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Sat, 26 Apr 2008 23:02:51 +0000 Subject: [PATCH] fix ridiculously critical omission in zip flush - we never set compressed file size! Augment zip test for bz2/zlib-compressed alias files to increase code coverage --- ext/phar/tests/zip/phar_setalias.phpt | 5 +++-- ext/phar/zip.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/phar/tests/zip/phar_setalias.phpt b/ext/phar/tests/zip/phar_setalias.phpt index 3a9cfce07e..19daa407dd 100644 --- a/ext/phar/tests/zip/phar_setalias.phpt +++ b/ext/phar/tests/zip/phar_setalias.phpt @@ -41,15 +41,16 @@ $phar->setAlias('unused'); $p2 = new Phar($fname2); echo $p2->getAlias(), "\n"; $p2->compressFiles(Phar::BZ2); -copy($fname3, $fname3); +copy($fname2, $fname3); $p2->setAlias('unused2'); $p3 = new Phar($fname3); echo $p3->getAlias(), "\n"; ?> ===DONE=== --CLEAN-- - diff --git a/ext/phar/zip.c b/ext/phar/zip.c index bf613a31f5..37c1a19787 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -606,6 +606,7 @@ static int phar_zip_changed_apply(void *data, void *arg TSRMLS_DC) /* {{{ */ php_stream_filter_remove(filter, 1 TSRMLS_CC); php_stream_seek(entry->cfp, 0, SEEK_END); entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp); + central.compsize = local.compsize = PHAR_SET_32(entry->compressed_filesize); /* generate crc on compressed file */ php_stream_rewind(entry->cfp); entry->old_flags = entry->flags; -- 2.50.1