--TEST-- Phar: disallow stub and alias setting via offset*() methods --SKIPIF-- --INI-- phar.readonly=0 phar.require_hash=1 --FILE-- setDefaultStub(); $phar->setAlias('susan'); $phar['a.txt'] = "first file\n"; $phar['b.txt'] = "second file\n"; try { $phar->offsetGet('.phar/stub.php'); } catch (Exception $e) { echo $e->getMessage()."\n"; } try { $phar->offsetGet('.phar/alias.txt'); } catch (Exception $e) { echo $e->getMessage()."\n"; } try { $phar->offsetSet('.phar/stub.php', ''); } catch (Exception $e) { echo $e->getMessage()."\n"; } var_dump(strlen($phar->getStub())); try { $phar->offsetUnset('.phar/stub.php'); } catch (Exception $e) { echo $e->getMessage()."\n"; } var_dump(strlen($phar->getStub())); try { $phar->offsetSet('.phar/alias.txt', 'dolly'); } catch (Exception $e) { echo $e->getMessage()."\n"; } var_dump($phar->getAlias()); try { $phar->offsetUnset('.phar/alias.txt'); } catch (Exception $e) { echo $e->getMessage()."\n"; } var_dump($phar->getAlias()); ?> ===DONE=== --CLEAN-- --EXPECTF-- Entry .phar/stub.php does not exist Entry .phar/alias.txt does not exist Cannot set stub ".phar/stub.php" directly in phar "%sphar_offset_check.phar.php", use setStub int(6675) int(6675) Cannot set alias ".phar/alias.txt" directly in phar "%sphar_offset_check.phar.php", use setAlias string(5) "susan" string(5) "susan" ===DONE===