1--TEST-- 2Phar: alias edge cases 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5--INI-- 6phar.readonly=0 7--FILE-- 8<?php 9 10$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar'; 11$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar'; 12 13$p = new Phar($fname); 14 15$p->setAlias('foo'); 16$p['unused'] = 'hi'; 17try { 18$a = new Phar($fname2, 0, 'foo'); 19} catch (Exception $e) { 20echo $e->getMessage(),"\n"; 21} 22copy($fname, $fname2); 23echo "2\n"; 24try { 25$a = new Phar($fname2); 26} catch (Exception $e) { 27echo $e->getMessage(),"\n"; 28} 29try { 30$b = new Phar($fname, 0, 'another'); 31} catch (Exception $e) { 32echo $e->getMessage(),"\n"; 33} 34?> 35===DONE=== 36--CLEAN-- 37<?php 38unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); 39unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar'); 40?> 41--EXPECTF-- 42alias "foo" is already used for archive "%salias_acrobatics.phar" cannot be overloaded with "%salias_acrobatics.2.phar" 432 44Cannot open archive "%salias_acrobatics.2.phar", alias is already in use by existing archive 45alias "another" is already used for archive "%salias_acrobatics.phar" cannot be overloaded with "%salias_acrobatics.phar" 46===DONE=== 47