- Phar:
. Fixed bug#52013 (Unable to decompress files in a compressed phar). (Hannes)
+ . Fixed bug#53872 (internal corruption of phar). (Hannes)
- NSAPI SAPI:
. Don't set $_SERVER['HTTPS'] on unsecure connection (bug #55403). (Uwe
--- /dev/null
+--TEST--\r
+bug#53872 (internal corruption of phar)\r
+--INI--\r
+phar.readonly=0\r
+--FILE--\r
+<?php\r
+$p=new Phar('bug53872-phar.phar');\r
+$p->buildFromDirectory(__DIR__ . "/bug53872/");\r
+$p->setStub('<?php __HALT_COMPILER();?\>');\r
+$p->compressFiles(Phar::GZ);\r
+\r
+print(file_get_contents('phar://bug53872-phar.phar/first.txt'));\r
+print(file_get_contents('phar://bug53872-phar.phar/second.txt'));\r
+print(file_get_contents('phar://bug53872-phar.phar/third.txt'));\r
+?>\r
+--CLEAN--\r
+<?php\r
+unlink("bug53872-phar.phar");\r
+?>\r
+--EXPECT--\r
+content of first.txt\r
+content of third.txt\r
+\r
php_stream_filter_append(&ufp->writefilters, filter);
php_stream_seek(phar_get_entrypfp(entry TSRMLS_CC), phar_get_fp_offset(entry TSRMLS_CC), SEEK_SET);
- if (SUCCESS != phar_stream_copy_to_stream(phar_get_entrypfp(entry TSRMLS_CC), ufp, entry->compressed_filesize, NULL)) {
- spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
- return FAILURE;
+ if (entry->uncompressed_filesize) {
+ if (SUCCESS != phar_stream_copy_to_stream(phar_get_entrypfp(entry TSRMLS_CC), ufp, entry->compressed_filesize, NULL)) {
+ spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
+ php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ return FAILURE;
+ }
}
php_stream_filter_flush(filter, 1);