]> granicus.if.org Git - php/commitdiff
new test for zip archives with files created from stdin
authorGreg Beaver <cellog@php.net>
Sat, 19 Apr 2008 05:53:57 +0000 (05:53 +0000)
committerGreg Beaver <cellog@php.net>
Sat, 19 Apr 2008 05:53:57 +0000 (05:53 +0000)
ext/phar/tests/zip/corrupt_006.phpt [new file with mode: 0644]
ext/phar/tests/zip/files/corrupt2.php.inc
ext/phar/tests/zip/files/encrypted.zip
ext/phar/tests/zip/files/stdin.zip [new file with mode: 0644]

diff --git a/ext/phar/tests/zip/corrupt_006.phpt b/ext/phar/tests/zip/corrupt_006.phpt
new file mode 100644 (file)
index 0000000..9c83617
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Phar: zip with file created from stdin
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
+--FILE--
+<?php
+try {
+       new PharData(dirname(__FILE__) . '/files/stdin.zip');
+} catch (Exception $e) {
+       echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
+--EXPECTF--
+phar error: Cannot process zips created from stdin (zero-length filename) in zip-based phar "%sstdin.zip"
+===DONE===
index b396d58290ebfc9f42758d452e514ae8af6a9e2f..646eb1bb93efa649c6d6b1e39ea943076bce6d75 100644 (file)
@@ -4,4 +4,8 @@ $a = new corrupt_zipmaker;
 $a->addFile('hi', null, 'hii');
 $a->addFile('hi2', null, 'hii2', null, null, 'encrypt', 'encrypt');
 $a->writeZip(dirname(__FILE__) . '/encrypted.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii');
+$a->addFile('', null, 'stdin');
+$a->writeZip(dirname(__FILE__) . '/stdin.zip');
 ?>
index 00aed14f04f0211ccc9d52ccc3c8cf86b24cf4bb..bb3727df2505836d08dcaef08e7cd56a0bd16da1 100644 (file)
Binary files a/ext/phar/tests/zip/files/encrypted.zip and b/ext/phar/tests/zip/files/encrypted.zip differ
diff --git a/ext/phar/tests/zip/files/stdin.zip b/ext/phar/tests/zip/files/stdin.zip
new file mode 100644 (file)
index 0000000..fdbe930
Binary files /dev/null and b/ext/phar/tests/zip/files/stdin.zip differ