--TEST-- Phar: getAlias() with an existing phar.zip --SKIPIF-- --INI-- phar.readonly=0 --FILE-- getAlias()); unset($phar); copy(__DIR__ . '/files/metadata.phar.zip', $fname); // existing phar.zip, no alias set $phar = new Phar($fname); var_dump($phar->getAlias()); // check that default alias can be overwritten $phar->setAlias('jiminycricket'); var_dump($phar->getAlias()); unset($phar); // existing phar.zip, alias set $phar = new Phar($fname); var_dump($phar->getAlias()); // check that alias can't be set manually try { $phar['.phar/alias.txt'] = 'pinocchio'; } catch (Exception $e) { echo $e->getMessage()."\n"; } var_dump($phar->getAlias()); // check that user-defined alias can be overwritten $phar->setAlias('pinocchio'); var_dump($phar->getAlias()); ?> ===DONE=== --CLEAN-- --EXPECTF-- string(%d) "%sgetalias.phar.zip" string(%d) "%sgetalias.phar.zip" string(13) "jiminycricket" string(13) "jiminycricket" Cannot set alias ".phar/alias.txt" directly in phar "%sgetalias.phar.zip", use setAlias string(13) "jiminycricket" string(9) "pinocchio" ===DONE===