mirror of
https://github.com/php/php-src.git
synced 2024-10-04 00:06:16 +00:00
b93b48663d
fix a whole bunch of zip-related bugs tar tests need some naming add phar information to error messages, fix existing tests to reflect this
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
--TEST--
|
|
Phar::chmod zip-based
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
|
<?php if (!extension_loaded("zip")) die("skip"); ?>
|
|
--INI--
|
|
phar.readonly=1
|
|
phar.require_hash=0
|
|
--FILE--
|
|
<?php
|
|
include dirname(__FILE__) . '/tarmaker.php.inc';
|
|
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
|
|
$pname = 'phar://hio';
|
|
|
|
$a = new tarmaker($fname, 'none');
|
|
$a->init();
|
|
$a->addFile('a.php', '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>');
|
|
$a->addFile('.phar/alias.txt', 'hio');
|
|
$a->mkDir('test');
|
|
$a->close();
|
|
|
|
try {
|
|
$a = new Phar($fname);
|
|
var_dump($a['a.php']->isExecutable());
|
|
$a['a.php']->chmod(0777);
|
|
var_dump($a['a.php']->isExecutable());
|
|
$a['a.php']->chmod(0666);
|
|
var_dump($a['a.php']->isExecutable());
|
|
echo "test dir\n";
|
|
var_dump($a['test']->isExecutable());
|
|
$a['test']->chmod(0777);
|
|
var_dump($a['test']->isExecutable());
|
|
$a['test']->chmod(0666);
|
|
var_dump($a['test']->isExecutable());
|
|
} catch (Exception $e) {
|
|
echo $e->getMessage() . "\n";
|
|
}
|
|
?>
|
|
===DONE===
|
|
--CLEAN--
|
|
<?php
|
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
|
|
?>
|
|
--EXPECTF--
|
|
bool(false)
|
|
Cannot modify permissions for file "a.php" in phar "%sa.1.phar.php", write operations are prohibited
|
|
===DONE===
|