]> granicus.if.org Git - php/commitdiff
new test for truncated manifest
authorGreg Beaver <cellog@php.net>
Thu, 8 Dec 2005 07:49:47 +0000 (07:49 +0000)
committerGreg Beaver <cellog@php.net>
Thu, 8 Dec 2005 07:49:47 +0000 (07:49 +0000)
ext/phar/tests/008.phpt [new file with mode: 0644]

diff --git a/ext/phar/tests/008.phpt b/ext/phar/tests/008.phpt
new file mode 100644 (file)
index 0000000..d101ba3
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+PHP_Archive::mapPhar improper parameters
+--SKIPIF--
+<?php if (!extension_loaded("phar")) print "skip";?>
+--FILE--
+<?php
+function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
+register_shutdown_function('cleanup');
+$file = "<?php
+PHP_Archive::mapPhar(5, 'hio', false);
+__HALT_COMPILER(); ?>";
+$file .= pack('V', 500) . 'notenough';
+file_put_contents(dirname(__FILE__) . '/008_phar.php', $file);
+include dirname(__FILE__) . '/008_phar.php';
+exit;
+PHP_Archive::mapPhar(5, 'hio', false);
+__HALT_COMPILER(); ?>
+--EXPECTF--
+Fatal error: PHP_Archive::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d
\ No newline at end of file