1--TEST-- 2Phar: ensure unset() works properly on a non-flushed phar archive 3--EXTENSIONS-- 4phar 5--INI-- 6phar.readonly=0 7--FILE-- 8<?php 9$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php'; 10$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.2.phar.php'; 11 12if (file_exists($fname)) unlink($fname); 13if (file_exists($fname2)) unlink($fname2); 14 15$phar = new Phar($fname); // no entries, never flushed 16$phar->setAlias('first'); 17$phar->setMetadata('hi'); 18unset($phar); 19 20$phar = new Phar($fname2); 21$phar['b'] = 'whatever'; // flushed 22try { 23 $phar->setAlias('first'); 24} catch(Exception $e) { 25 echo $e->getMessage()."\n"; 26} 27 28$phar = new Phar($fname); 29var_dump($phar->getMetadata()); 30var_dump($phar->getAlias()); 31var_dump(file_exists($fname)); 32 33?> 34--CLEAN-- 35<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?> 36--EXPECTF-- 37NULL 38string(%d) "%stest_unset.phar.php" 39bool(false) 40