xref: /PHP-7.4/ext/phar/tests/016b.phpt (revision 26dfce7f)
1--TEST--
2Phar::mapPhar invalid file (gzipped file length is too short)
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip");?>
5<?php if (!extension_loaded("zlib")) die("skip zlib not present"); ?>
6--INI--
7phar.require_hash=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
11$pname = 'phar://' . $fname;
12$file = "<?php __HALT_COMPILER(); ?>";
13// file length is too short
14
15$files = array();
16$files['a'] = array('cont'=>'a','flags'=>0x00001000, 'clen' => 1);
17include 'files/phar_test.inc';
18
19echo file_get_contents($pname . '/a');
20?>
21--CLEAN--
22<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
23--EXPECTF--
24Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "a") in %s on line %d
25