cellog Sat Oct 11 20:57:08 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/phar/tests/zip zlib.phpt /php-src/ext/phar/tests/zip/files zlib_alias.phar.zip
Modified files: /php-src/ext/phar zip.c /php-src/ext/phar/tests/zip bzip2.phpt /php-src/ext/phar/tests/zip/files bz2_alias.phar.zip Log: work around crap stream filter implementation, update tests for compressed aliases in zip-based phar so they actually test the compression http://cvs.php.net/viewvc.cgi/php-src/ext/phar/zip.c?r1=1.47.2.20&r2=1.47.2.21&diff_format=u Index: php-src/ext/phar/zip.c diff -u php-src/ext/phar/zip.c:1.47.2.20 php-src/ext/phar/zip.c:1.47.2.21 --- php-src/ext/phar/zip.c:1.47.2.20 Mon Sep 22 01:39:11 2008 +++ php-src/ext/phar/zip.c Sat Oct 11 20:57:07 2008 @@ -489,6 +489,13 @@ fp->writepos = fp->readpos = 0; #endif php_stream_seek(fp, entry.offset, SEEK_SET); + /* these next lines should be for php < 5.2.6 after 5.3 filters are fixed */ + fp->writepos = 0; + fp->readpos = 0; + php_stream_seek(fp, entry.offset, SEEK_SET); + fp->writepos = 0; + fp->readpos = 0; + /* the above lines should be for php < 5.2.6 after 5.3 filters are fixed */ mydata->alias_len = entry.uncompressed_filesize; @@ -504,6 +511,9 @@ if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { pefree(entry.filename, entry.is_persistent); +#if PHP_VERSION_ID < 50207 + PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); +#endif PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -522,6 +532,9 @@ if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { pefree(entry.filename, entry.is_persistent); +#if PHP_VERSION_ID < 50207 + PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); +#endif PHAR_ZIP_FAIL("unable to read in alias, truncated"); } http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/bzip2.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/phar/tests/zip/bzip2.phpt diff -u php-src/ext/phar/tests/zip/bzip2.phpt:1.1.2.2 php-src/ext/phar/tests/zip/bzip2.phpt:1.1.2.3 --- php-src/ext/phar/tests/zip/bzip2.phpt:1.1.2.2 Sun Sep 14 06:31:20 2008 +++ php-src/ext/phar/tests/zip/bzip2.phpt Sat Oct 11 20:57:08 2008 @@ -79,5 +79,5 @@ $a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 11); $a->writeZip(dirname(__FILE__) . '/compress_unsupunknown.zip'); ?> -string(7) "hithere" +string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip" ===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/files/bz2_alias.phar.zip?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/phar/tests/zip/files/bz2_alias.phar.zip http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/zlib.phpt?view=markup&rev=1.1 Index: php-src/ext/phar/tests/zip/zlib.phpt +++ php-src/ext/phar/tests/zip/zlib.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/files/zlib_alias.phar.zip?view=markup&rev=1.1 Index: php-src/ext/phar/tests/zip/files/zlib_alias.phar.zip +++ php-src/ext/phar/tests/zip/files/zlib_alias.phar.zip -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php