$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 11);
$a->writeZip(dirname(__FILE__) . '/compress_unsupunknown.zip');
?>
-string(7) "hithere"
+string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip"
===DONE===
--- /dev/null
+--TEST--
+Phar: process zlib-compressed zip alias
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
+<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
+--FILE--
+<?php
+try {
+ $a = new Phar(dirname(__FILE__) . '/files/zlib_alias.phar.zip');
+ var_dump($a->getAlias());
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
+--EXPECT--
+string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip"
+===DONE===
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;
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");
}
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");
}