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 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip'; 11$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.2.phar.zip'; 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--CLEAN-- 36<?php 37unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); 38unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip'); 39?> 40--EXPECTF-- 41alias "foo" is already used for archive "%salias_acrobatics.phar.zip" cannot be overloaded with "%salias_acrobatics.2.phar.zip" 422 43phar error: Unable to add zip-based phar "%salias_acrobatics.2.phar.zip" with implicit alias, alias is already in use 44alias "another" is already used for archive "%salias_acrobatics.phar.zip" cannot be overloaded with "%salias_acrobatics.phar.zip" 45