From: Greg Beaver Date: Sat, 19 Apr 2008 05:35:03 +0000 (+0000) Subject: new corrupt zip test X-Git-Tag: RELEASE_2_0_0b1~327 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e98585ff7fb3ac9185228e2e96da6cf303dcf83;p=php new corrupt zip test --- diff --git a/ext/phar/tests/zip/corrupt_002.phpt b/ext/phar/tests/zip/corrupt_002.phpt new file mode 100644 index 0000000000..86a271231d --- /dev/null +++ b/ext/phar/tests/zip/corrupt_002.phpt @@ -0,0 +1,17 @@ +--TEST-- +Phar: corrupted zip (no end of zip record) +--SKIPIF-- + + +--FILE-- +getMessage() . "\n"; +} +?> +===DONE=== +--EXPECTF-- +phar error: end of central directory not found in zip-based phar "%snozipend.zip" +===DONE=== diff --git a/ext/phar/tests/zip/files/corrupt_count1.php.inc b/ext/phar/tests/zip/files/corrupt_count1.php.inc index 59017d6030..2a5e01a8fd 100644 --- a/ext/phar/tests/zip/files/corrupt_count1.php.inc +++ b/ext/phar/tests/zip/files/corrupt_count1.php.inc @@ -5,4 +5,5 @@ $a->addFile('hi', null, 'hii'); $a->addFile('hi2', null, 'hii2'); $a->writeZip(dirname(__FILE__) . '/count1.zip', 'count1'); $a->writeZip(dirname(__FILE__) . '/count2.zip', 'count2'); +$a->writeZip(dirname(__FILE__) . '/nozipend.zip', 'none'); ?> diff --git a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc index 315cca0c19..98d99ce24d 100644 --- a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc +++ b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc @@ -279,6 +279,7 @@ class corrupt_zipmaker strlen($this->start), $this->offset + 1, strlen($this->comment) + 1) . $this->comment; break; + case 'none' : } file_put_contents($zipfile, $write); } diff --git a/ext/phar/tests/zip/files/count1.zip b/ext/phar/tests/zip/files/count1.zip index 3b9577229a..adfb4a9f1e 100644 Binary files a/ext/phar/tests/zip/files/count1.zip and b/ext/phar/tests/zip/files/count1.zip differ diff --git a/ext/phar/tests/zip/files/count2.zip b/ext/phar/tests/zip/files/count2.zip index 8dfd82e540..6976cb1a1f 100644 Binary files a/ext/phar/tests/zip/files/count2.zip and b/ext/phar/tests/zip/files/count2.zip differ diff --git a/ext/phar/tests/zip/files/nozipend.zip b/ext/phar/tests/zip/files/nozipend.zip new file mode 100644 index 0000000000..b64f597c38 Binary files /dev/null and b/ext/phar/tests/zip/files/nozipend.zip differ