delete.phpt 758 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Phar: delete test, zip-based phar
  3. --EXTENSIONS--
  4. phar
  5. --INI--
  6. phar.readonly=0
  7. phar.require_hash=0
  8. --FILE--
  9. <?php
  10. $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
  11. $alias = 'phar://' . $fname;
  12. $file = "<?php
  13. Phar::mapPhar('hio');
  14. __HALT_COMPILER(); ?>";
  15. $phar = new Phar($fname);
  16. $phar['a'] = 'a';
  17. $phar->setStub($file);
  18. $phar->stopBuffering();
  19. echo file_get_contents($alias . '/a') . "\n";
  20. $phar->delete('a');
  21. echo file_get_contents($alias . '/a') . "\n";
  22. ?>
  23. --CLEAN--
  24. <?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
  25. --EXPECTF--
  26. a
  27. Warning: file_get_contents(phar://%sdelete.phar.zip/a): Failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.zip" in %sdelete.php on line %d