mirror of
https://github.com/php/php-src.git
synced 2024-09-30 22:36:12 +00:00
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
--TEST--
|
|
Phar::mapPhar filesize too small in manifest
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("phar")) print "skip";?>
|
|
--FILE--
|
|
<?php
|
|
$file = "<?php
|
|
Phar::mapPhar('hio');
|
|
__HALT_COMPILER(); ?>";
|
|
|
|
// compressed file length does not match incompressed lentgh for an uncompressed file
|
|
|
|
$files = array();
|
|
$files['a'] = 'a';
|
|
$manifest = '';
|
|
foreach($files as $name => $cont) {
|
|
$len = strlen($cont);
|
|
$manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len+1, crc32($cont), 0);
|
|
}
|
|
$alias = 'hio';
|
|
$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
|
|
$file .= pack('V', strlen($manifest)) . $manifest;
|
|
foreach($files as $cont)
|
|
{
|
|
$file .= $cont;
|
|
}
|
|
|
|
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
|
|
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
|
echo file_get_contents('phar://hio/a');
|
|
?>
|
|
--CLEAN--
|
|
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
|
--EXPECTF--
|
|
Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (compressed and uncompressed size does not match for uncompressed entry) in %s on line %d
|