mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
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
This commit is contained in:
parent
11c93b8494
commit
fade22bfd8
2 changed files with 4 additions and 2 deletions
|
@ -41,7 +41,7 @@ $phar->setAlias('unused');
|
||||||
$p2 = new Phar($fname2);
|
$p2 = new Phar($fname2);
|
||||||
echo $p2->getAlias(), "\n";
|
echo $p2->getAlias(), "\n";
|
||||||
$p2->compressFiles(Phar::BZ2);
|
$p2->compressFiles(Phar::BZ2);
|
||||||
copy($fname3, $fname3);
|
copy($fname2, $fname3);
|
||||||
$p2->setAlias('unused2');
|
$p2->setAlias('unused2');
|
||||||
$p3 = new Phar($fname3);
|
$p3 = new Phar($fname3);
|
||||||
echo $p3->getAlias(), "\n";
|
echo $p3->getAlias(), "\n";
|
||||||
|
@ -50,6 +50,7 @@ echo $p3->getAlias(), "\n";
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
|
||||||
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '2.phar.zip');
|
||||||
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.zip');
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.zip');
|
||||||
__HALT_COMPILER();
|
__HALT_COMPILER();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -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_filter_remove(filter, 1 TSRMLS_CC);
|
||||||
php_stream_seek(entry->cfp, 0, SEEK_END);
|
php_stream_seek(entry->cfp, 0, SEEK_END);
|
||||||
entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp);
|
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 */
|
/* generate crc on compressed file */
|
||||||
php_stream_rewind(entry->cfp);
|
php_stream_rewind(entry->cfp);
|
||||||
entry->old_flags = entry->flags;
|
entry->old_flags = entry->flags;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue