xref: /PHP-5.6/ext/phar/tests/zip/exists_as_phar.phpt (revision 16b4d8e0)
1--TEST--
2Phar: phar-based phar named with ".zip" fails
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10
11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
12$tname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
13$alias = 'phar://hio';
14
15$phar = new Phar($fname);
16$phar['a.php'] = '<?php echo "This is a\n"; include "'.$alias.'/b.php"; ?>';
17$phar->setAlias('hio');
18$phar->addEmptyDir('test');
19$phar->stopBuffering();
20copy($fname, $tname);
21$phar->setAlias('hio2');
22
23try {
24	$p = new Phar($tname);
25} catch (Exception $e) {
26	echo $e->getMessage() . "\n";
27}
28
29?>
30===DONE===
31--CLEAN--
32<?php
33unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
34unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
35?>
36--EXPECTF--
37phar zip error: phar "%sexists_as_phar.phar.zip" already exists as a regular phar and must be deleted from disk prior to creating as a zip-based phar
38===DONE===
39