<?php if (!extension_loaded("phar")) print "skip"; ?>
--FILE--
<?php
-echo PHP_Archive::apiVersion();
+echo Phar::apiVersion();
?>
--EXPECT--
0.7.1
\ No newline at end of file
<?php if (!extension_loaded("phar")) print "skip"; ?>
--FILE--
<?php
-PHP_Archive::mapPhar();
-PHP_Archive::mapPhar(5);
-PHP_Archive::mapPhar(5, 5);
-PHP_Archive::mapPhar(5, 'hio');
-PHP_Archive::mapPhar(5, 'hio', 'hi');
+Phar::mapPhar();
+Phar::mapPhar(5);
+Phar::mapPhar(5, 5);
+Phar::mapPhar(5, 'hio');
+Phar::mapPhar(5, 'hio', 'hi');
__HALT_COMPILER(); ?>
--EXPECTF--
-Warning: PHP_Archive::mapPhar() expects at least 2 parameters, 0 given in %s on line %d
+Warning: Phar::mapPhar() expects at least 2 parameters, 0 given in %s on line %d
-Warning: PHP_Archive::mapPhar() expects at least 2 parameters, 1 given in %s on line %d
+Warning: Phar::mapPhar() expects at least 2 parameters, 1 given in %s on line %d
-Fatal error: PHP_Archive::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d
\ No newline at end of file
+Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d
\ No newline at end of file
--TEST--
PHP_Archive::mapPhar zlib not loaded
--SKIPIF--
-<?php if (!extension_loaded("phar")) print "skip";
-if (PHP_Archive::canCompress()) print "skip";?>
+<?php if (!extension_loaded("phar")) print "skip zlib is present";
+if (Phar::canCompress()) print "skip";?>
--FILE--
<?php
-PHP_Archive::mapPhar(5, 'hio', true);
+Phar::mapPhar(5, 'hio', true);
?>
--EXPECTF--
-Fatal error: PHP_Archive::mapPhar(): zlib extension is required for compressed .phar files
\ No newline at end of file
+Fatal error: Phar::mapPhar(): zlib extension is required for compressed .phar files
\ No newline at end of file
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::mapPhar(5, 'hio', false);
?>
--EXPECTF--
-Fatal error: PHP_Archive::mapPhar(): __HALT_COMPILER(); must be declared in a phar in %s on line %d
\ No newline at end of file
+Fatal error: Phar::mapPhar(): __HALT_COMPILER(); must be declared in a phar in %s on line %d
\ No newline at end of file
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::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
+Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d
\ No newline at end of file
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::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
+Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d
\ No newline at end of file
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::mapPhar(5, 'hio', false);
__HALT_COMPILER(); ?>~~~~
--EXPECTF--
-Fatal error: PHP_Archive::mapPhar(): manifest cannot be larger than 1 MB in phar "%s" in %s on line %d
\ No newline at end of file
+Fatal error: Phar::mapPhar(): manifest cannot be larger than 1 MB in phar "%s" in %s on line %d
\ No newline at end of file
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::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';
?>
--EXPECTF--
-Fatal error: PHP_Archive::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d
\ No newline at end of file
+Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d
\ No newline at end of file
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::mapPhar(5, 'hio', false);
__HALT_COMPILER(); ?>";
$file .= pack('VV', 500, 500) . str_repeat('A', 500);
file_put_contents(dirname(__FILE__) . '/008_phar.php', $file);
include dirname(__FILE__) . '/008_phar.php';
?>
--EXPECTF--
-Fatal error: PHP_Archive::mapPhar(): too many manifest entries for size of manifest in phar "%s" in %s on line %d
\ No newline at end of file
+Fatal error: Phar::mapPhar(): too many manifest entries for size of manifest in phar "%s" in %s on line %d
\ No newline at end of file
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::mapPhar(5, 'hio', false);
__HALT_COMPILER(); ?>";
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 1);
// this fails because the manifest length does not include the 4-byte "length of manifest" data
echo file_get_contents('phar://hio/a');
?>
--EXPECTF--
-Fatal error: PHP_Archive::mapPhar(): internal corruption of phar "%s" (buffer overrun) in %s on line %d
\ No newline at end of file
+Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (buffer overrun) in %s on line %d
\ No newline at end of file
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar(5, 'hio', false);
+Phar::mapPhar(5, 'hio', false);
__HALT_COMPILER(); ?>";
// compressed file length does not include 8 bytes for crc/file length and should
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 1);
echo file_get_contents('phar://hio/a');
?>
--EXPECTF--
-Fatal error: PHP_Archive::mapPhar(): internal corruption of phar "%s" (file size in phar is not large enough) in %s on line %d
\ No newline at end of file
+Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (file size in phar is not large enough) in %s on line %d
\ No newline at end of file
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', false);
+Phar::mapPhar('hio', false);
__HALT_COMPILER(); ?>";
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
$file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . 'a';
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', false);
+Phar::mapPhar('hio', false);
__HALT_COMPILER(); ?>";
// filesize should be 1, and is 2
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', false);
+Phar::mapPhar('hio', false);
__HALT_COMPILER(); ?>";
// wrong crc32
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', true);
+Phar::mapPhar('hio', true);
__HALT_COMPILER(); ?>";
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 11);
$file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . chr(75) . chr(4) . chr(0); // 'a' gzdeflated
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', true);
+Phar::mapPhar('hio', true);
__HALT_COMPILER(); ?>";
// file length is too short
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', true);
+Phar::mapPhar('hio', true);
__HALT_COMPILER(); ?>";
// file length is too short
$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', true);
+Phar::mapPhar('hio', true);
__HALT_COMPILER(); ?>";
$manifest = '';
$manifest .= pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', true);
+Phar::mapPhar('hio', true);
__HALT_COMPILER(); ?>";
$manifest = '';
$manifest .= pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', false);
+Phar::mapPhar('hio', false);
__HALT_COMPILER(); ?>";
$manifest = '';
$manifest .= pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', false);
+Phar::mapPhar('hio', false);
__HALT_COMPILER(); ?>";
$manifest = '';
$manifest .= pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9);
function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); }
register_shutdown_function('cleanup');
$file = "<?php
-PHP_Archive::mapPhar('hio', false);
+Phar::mapPhar('hio', false);
__HALT_COMPILER(); ?>";
$contents = 'abcdefg';
$manifest = pack('V', 1) . 'a' . pack('VVVV', strlen($contents), time(), 0, 8 + strlen($contents));