new test for truncated manifest

This commit is contained in:
Greg Beaver 2005-12-08 07:49:47 +00:00
parent 68a5fdea12
commit f86df41ff4

19
ext/phar/tests/008.phpt Normal file
View File

@ -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