xref: /PHP-5.3/ext/phar/tests/029.phpt (revision 610c7fbe)
1--TEST--
2Phar::loadPhar overloading alias names
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7--FILE--
8<?php
9$fname1 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
10$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.php';
11$fname = $fname1;
12$alias = '';
13$pname = 'phar://hio';
14$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
15
16$files = array();
17$files['a.php']   = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
18$files['b.php']   = '<?php echo "This is b\n"; include "'.$pname.'/b/c.php"; ?>';
19$files['b/c.php'] = '<?php echo "This is b/c\n"; include "'.$pname.'/b/d.php"; ?>';
20$files['b/d.php'] = '<?php echo "This is b/d\n"; include "'.$pname.'/e.php"; ?>';
21$files['e.php']   = '<?php echo "This is e\n"; ?>';
22
23include 'files/phar_test.inc';
24
25copy($fname1, $fname2);
26
27var_dump(Phar::loadPhar($fname1, 'hio'));
28var_dump(Phar::loadPhar($fname1, 'copy'));
29$a = new Phar($fname1);
30try
31{
32	var_dump(Phar::loadPhar($fname2, 'copy'));
33}
34catch (Exception $e)
35{
36	echo $e->getMessage() . "\n";
37}
38
39?>
40===DONE===
41--CLEAN--
42<?php
43unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
44unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php');
45?>
46--EXPECTF--
47bool(true)
48bool(true)
49alias "copy" is already used for archive "%s029.1.phar.php" cannot be overloaded with "%s029.2.phar.php"
50===DONE===
51