xref: /PHP-8.0/ext/phar/tests/zip/delete.phpt (revision d1764ca3)
1--TEST--
2Phar: delete test, zip-based phar
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10
11$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
12$alias = 'phar://' . $fname;
13$file = "<?php
14Phar::mapPhar('hio');
15__HALT_COMPILER(); ?>";
16
17$phar = new Phar($fname);
18$phar['a'] = 'a';
19$phar->setStub($file);
20$phar->stopBuffering();
21
22echo file_get_contents($alias . '/a') . "\n";
23$phar->delete('a');
24echo file_get_contents($alias . '/a') . "\n";
25?>
26--CLEAN--
27<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
28--EXPECTF--
29a
30
31Warning: 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
32