xref: /PHP-7.4/ext/phar/tests/008.phpt (revision 26dfce7f)
1--TEST--
2Phar::mapPhar truncated manifest (not enough for manifest length)
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip");?>
5--FILE--
6<?php
7$file = "<?php
8Phar::mapPhar('hio');
9__HALT_COMPILER(); ?>";
10$file .= pack('V', 500) . 'notenough';
11file_put_contents(__DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
12try {
13include __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
14} catch (Exception $e) {
15echo $e->getMessage();
16}
17?>
18--CLEAN--
19<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
20--EXPECTF--
21internal corruption of phar "%s" (truncated manifest header)
22