xref: /PHP-5.3/ext/phar/tests/invalid_alias.phpt (revision 16b4d8e0)
1--TEST--
2Phar: set alias with invalid alias containing / \ : or ;
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7--FILE--
8<?php
9$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
10
11$p = new Phar($fname);
12try {
13	$p->setAlias('hi/');
14} catch (Exception $e) {
15	echo $e->getMessage() . "\n";
16}
17try {
18	$p->setAlias('hi\\l');
19} catch (Exception $e) {
20	echo $e->getMessage() . "\n";
21}
22
23try {
24	$p->setAlias('hil;');
25} catch (Exception $e) {
26	echo $e->getMessage() . "\n";
27}
28
29try {
30	$p->setAlias(':hil');
31} catch (Exception $e) {
32	echo $e->getMessage() . "\n";
33}
34?>
35===DONE===
36--CLEAN--
37<?php
38unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
39?>
40--EXPECTF--
41Invalid alias "hi/" specified for phar "%sinvalid_alias.phar"
42Invalid alias "hi\l" specified for phar "%sinvalid_alias.phar"
43Invalid alias "hil;" specified for phar "%sinvalid_alias.phar"
44Invalid alias ":hil" specified for phar "%sinvalid_alias.phar"
45===DONE===