xref: /PHP-7.3/ext/phar/tests/033a.phpt (revision 782352c5)
1--TEST--
2Phar::chmod
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=1
7phar.require_hash=0
8--FILE--
9<?php
10$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
11$pname = 'phar://hio';
12$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
13
14$files = array();
15$files['a.php']   = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
16include 'files/phar_test.inc';
17try {
18	$a = new Phar($fname);
19	var_dump($a['a.php']->isExecutable());
20	$a['a.php']->chmod(0777);
21	var_dump($a['a.php']->isExecutable());
22	$a['a.php']->chmod(0666);
23	var_dump($a['a.php']->isExecutable());
24} catch (Exception $e) {
25	echo $e->getMessage() . "\n";
26}
27?>
28===DONE===
29--CLEAN--
30<?php
31unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
32?>
33--EXPECTF--
34bool(false)
35Cannot modify permissions for file "a.php" in phar "%s033a.1.phar.php", write operations are prohibited
36===DONE===
37