delete_in_phar.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Phar: delete a file within a .phar
  3. --EXTENSIONS--
  4. phar
  5. --INI--
  6. phar.readonly=0
  7. phar.require_hash=0
  8. opcache.validate_timestamps=1
  9. --FILE--
  10. <?php
  11. $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
  12. $pname = 'phar://' . $fname;
  13. $file = "<?php __HALT_COMPILER(); ?>";
  14. $files = array();
  15. $files['a.php'] = '<?php echo "This is a\n"; ?>';
  16. $files['b.php'] = '<?php echo "This is b\n"; ?>';
  17. $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
  18. include 'files/phar_test.inc';
  19. include $pname . '/a.php';
  20. include $pname . '/b.php';
  21. include $pname . '/b/c.php';
  22. unlink($pname . '/b/c.php');
  23. ?>
  24. ===AFTER===
  25. <?php
  26. include $pname . '/a.php';
  27. include $pname . '/b.php';
  28. include $pname . '/b/c.php';
  29. ?>
  30. --CLEAN--
  31. <?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
  32. --EXPECTF--
  33. This is a
  34. This is b
  35. This is b/c
  36. ===AFTER===
  37. This is a
  38. This is b
  39. Warning: include(%sdelete_in_phar.phar.php/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.php" in %sdelete_in_phar.php on line %d
  40. Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d