xref: /PHP-8.1/ext/phar/tests/033a.phpt (revision 74859783)
1--TEST--
2Phar::chmod
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=1
7phar.require_hash=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . 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--CLEAN--
29<?php
30unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
31?>
32--EXPECTF--
33bool(false)
34Cannot modify permissions for file "a.php" in phar "%s033a.1.phar.php", write operations are prohibited
35