Annotation of embedaddon/php/ext/phar/tests/tar/033a.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar::chmod tar-based
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.readonly=0
7: phar.require_hash=0
8: --FILE--
9: <?php
10:
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
12: $alias = 'phar://hio';
13:
14: $phar = new Phar($fname);
15: $phar['a.php'] = '<?php echo "This is a\n"; include "'.$alias.'/b.php"; ?>';
16: $phar->setAlias('hio');
17: $phar->addEmptyDir('test');
18: $phar->stopBuffering();
19: ini_set('phar.readonly', 1);
20:
21: try {
22: var_dump($phar['a.php']->isExecutable());
23: $phar['a.php']->chmod(0777);
24: var_dump($phar['a.php']->isExecutable());
25: $phar['a.php']->chmod(0666);
26: var_dump($phar['a.php']->isExecutable());
27: echo "test dir\n";
28: var_dump($phar['test']->isReadable());
29: $phar['test']->chmod(0000);
30: var_dump($phar['test']->isReadable());
31: $phar['test']->chmod(0666);
32: var_dump($phar['test']->isReadable());
33: } catch (Exception $e) {
34: echo $e->getMessage() . "\n";
35: }
36: ?>
37: ===DONE===
38: --CLEAN--
39: <?php
40: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
41: ?>
42: --EXPECTF--
43: bool(false)
44: Cannot modify permissions for file "a.php" in phar "%s033a.phar.tar", write operations are prohibited
45: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>