mirror of
https://github.com/php/php-src.git
synced 2024-12-14 04:16:30 +08:00
add complete tests verifying copy-on-write for cached phars
This commit is contained in:
parent
5bc1122056
commit
3a54017556
24
ext/phar/tests/cache_list/copyonwrite10.phar.phpt
Normal file
24
ext/phar/tests/cache_list/copyonwrite10.phar.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 10 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite10.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write10.phar
|
||||
--EXPECTF--
|
||||
string(214) "<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getStub());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$a = fopen("phar://" . __FILE__ . "/test.txt", "r");
|
||||
$p->setStub($a);
|
||||
echo $p2->getStub(),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER(); ?>
|
||||
"
|
||||
<?php __HALT_COMPILER(); ?>
|
||||
|
||||
ok
|
22
ext/phar/tests/cache_list/copyonwrite11.phar.phpt
Normal file
22
ext/phar/tests/cache_list/copyonwrite11.phar.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 11 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite11.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write11.phar
|
||||
--EXPECTF--
|
||||
string(174) "<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getStub());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->setDefaultStub();
|
||||
echo strlen($p2->getStub()),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER(); ?>
|
||||
"
|
||||
6685
|
||||
ok
|
24
ext/phar/tests/cache_list/copyonwrite12.phar.phpt
Normal file
24
ext/phar/tests/cache_list/copyonwrite12.phar.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 12 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite12.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write12.phar
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
["hash"]=>
|
||||
string(40) "0163F471460EA74F7636268D28289BF5A1E8BD72"
|
||||
["hash_type"]=>
|
||||
string(5) "SHA-1"
|
||||
}
|
||||
array(2) {
|
||||
["hash"]=>
|
||||
string(32) "%s"
|
||||
["hash_type"]=>
|
||||
string(3) "MD5"
|
||||
}
|
||||
ok
|
15
ext/phar/tests/cache_list/copyonwrite13.phar.phpt
Normal file
15
ext/phar/tests/cache_list/copyonwrite13.phar.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 13 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite13.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (!extension_loaded("zlib")) die("skip no zlib extension"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write13.phar
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(true)
|
||||
ok
|
15
ext/phar/tests/cache_list/copyonwrite14.phar.phpt
Normal file
15
ext/phar/tests/cache_list/copyonwrite14.phar.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 14 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite14.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (!extension_loaded("zlib")) die("skip no zlib extension"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write14.phar
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(false)
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite15.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite15.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 15 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite15.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write15.phar
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(true)
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite16.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite16.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 16 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite16.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write16.phar
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(false)
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite17.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite17.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 17 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite17.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write17.phar
|
||||
--EXPECTF--
|
||||
NULL
|
||||
string(2) "hi"
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite18.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite18.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 18 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite18.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write18.phar
|
||||
--EXPECTF--
|
||||
100666
|
||||
100444
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite19.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite19.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 19 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite19.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write19.phar
|
||||
--EXPECTF--
|
||||
string(2) "hi"
|
||||
string(3) "hi2"
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite20.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite20.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 20 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite20.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write20.phar
|
||||
--EXPECTF--
|
||||
string(2) "hi"
|
||||
NULL
|
||||
ok
|
15
ext/phar/tests/cache_list/copyonwrite21.phar.phpt
Normal file
15
ext/phar/tests/cache_list/copyonwrite21.phar.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 21 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite21.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (!extension_loaded("zlib")) die("skip no zlib extension"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write21.phar
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(true)
|
||||
ok
|
15
ext/phar/tests/cache_list/copyonwrite22.phar.phpt
Normal file
15
ext/phar/tests/cache_list/copyonwrite22.phar.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 22 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite22.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (!extension_loaded("zlib")) die("skip no zlib extension"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write22.phar
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(false)
|
||||
ok
|
17
ext/phar/tests/cache_list/copyonwrite23.phar.phpt
Normal file
17
ext/phar/tests/cache_list/copyonwrite23.phar.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 23 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite23.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (!extension_loaded("zlib")) die("skip no zlib extension"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write23.phar
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
ok
|
15
ext/phar/tests/cache_list/copyonwrite24.phar.phpt
Normal file
15
ext/phar/tests/cache_list/copyonwrite24.phar.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 24 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite24.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (!extension_loaded("zlib")) die("skip no zlib extension"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write24.phar
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(true)
|
||||
ok
|
15
ext/phar/tests/cache_list/copyonwrite4.phar.phpt
Normal file
15
ext/phar/tests/cache_list/copyonwrite4.phar.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 4 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite4.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write4.phar
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(true)
|
||||
string(2) "hi"
|
||||
ok
|
20
ext/phar/tests/cache_list/copyonwrite4a.phpt
Normal file
20
ext/phar/tests/cache_list/copyonwrite4a.phpt
Normal file
@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 4a [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite4.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(file_exists('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt'));
|
||||
Phar::mount('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt', 'phar://' . dirname(__FILE__) . '/files/write4.phar/tobemounted');
|
||||
var_dump(file_exists('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt'), file_get_contents('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(true)
|
||||
string(2) "hi"
|
||||
===DONE===
|
27
ext/phar/tests/cache_list/copyonwrite5.phar.phpt
Normal file
27
ext/phar/tests/cache_list/copyonwrite5.phar.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 5 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite5.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write5.phar
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/copyonwrite5/file1');
|
||||
unlink(dirname(__FILE__) . '/copyonwrite5/file2');
|
||||
rmdir(dirname(__FILE__) . '/copyonwrite5');
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
["file1"]=>
|
||||
string(%d) "%sfile1"
|
||||
["file2"]=>
|
||||
string(%d) "%sfile2"
|
||||
}
|
||||
phar://%scopyonwrite5.phar.php%cfile1 file1
|
||||
phar://%scopyonwrite5.phar.php%cfile2 file2
|
||||
phar://%scopyonwrite5.phar.php%chi hi
|
||||
ok
|
27
ext/phar/tests/cache_list/copyonwrite6.phar.phpt
Normal file
27
ext/phar/tests/cache_list/copyonwrite6.phar.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 6 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite6.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write6.phar
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/copyonwrite6/file1');
|
||||
unlink(dirname(__FILE__) . '/copyonwrite6/file2');
|
||||
rmdir(dirname(__FILE__) . '/copyonwrite6');
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
["file1"]=>
|
||||
string(%d) "%sfile1"
|
||||
["file2"]=>
|
||||
string(%d) "%sfile2"
|
||||
}
|
||||
phar://%scopyonwrite6.phar.php%cfile1 file1
|
||||
phar://%scopyonwrite6.phar.php%cfile2 file2
|
||||
phar://%scopyonwrite6.phar.php%chi hi
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite7.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite7.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 7 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite7.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write7.phar
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
ok
|
14
ext/phar/tests/cache_list/copyonwrite8.phar.phpt
Normal file
14
ext/phar/tests/cache_list/copyonwrite8.phar.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 8 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite8.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write8.phar
|
||||
--EXPECTF--
|
||||
string(%s) "%scopyonwrite8.phar.php"
|
||||
hi
|
||||
ok
|
23
ext/phar/tests/cache_list/copyonwrite9.phar.phpt
Normal file
23
ext/phar/tests/cache_list/copyonwrite9.phar.phpt
Normal file
@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Phar: copy-on-write test 9 [cache_list]
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
phar.cache_list={PWD}/copyonwrite9.phar.php
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE_EXTERNAL--
|
||||
files/write9.phar
|
||||
--EXPECTF--
|
||||
string(188) "<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getStub());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->setStub("<?php __HALT"."_COMPILER();");
|
||||
echo $p2->getStub(),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER(); ?>
|
||||
"
|
||||
<?php __HALT_COMPILER(); ?>
|
||||
|
||||
ok
|
BIN
ext/phar/tests/cache_list/files/write10.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write10.phar
Normal file
Binary file not shown.
18
ext/phar/tests/cache_list/files/write10.phar.inc
Normal file
18
ext/phar/tests/cache_list/files/write10.phar.inc
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write10.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getStub());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$a = fopen("phar://" . __FILE__ . "/test.txt", "r");
|
||||
$p->setStub($a);
|
||||
echo $p2->getStub(),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write11.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write11.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write11.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write11.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write11.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getStub());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->setDefaultStub();
|
||||
echo strlen($p2->getStub()),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write12.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write12.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write12.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write12.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write12.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getSignature());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->setSignatureAlgorithm(Phar::MD5);
|
||||
var_dump($p->getSignature());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write13.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write13.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write13.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write13.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write13.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->compressFiles(Phar::GZ);
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write14.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write14.phar
Normal file
Binary file not shown.
18
ext/phar/tests/cache_list/files/write14.phar.inc
Normal file
18
ext/phar/tests/cache_list/files/write14.phar.inc
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write14.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->decompressFiles();
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
$phar->compressFiles(Phar::GZ);
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write15.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write15.phar
Normal file
Binary file not shown.
16
ext/phar/tests/cache_list/files/write15.phar.inc
Normal file
16
ext/phar/tests/cache_list/files/write15.phar.inc
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write15.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump(isset($p["copied"]));
|
||||
$p->copy("test.txt","copied");
|
||||
var_dump(isset($p["copied"]));
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write16.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write16.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write16.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write16.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write16.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump(isset($p["test.txt"]));
|
||||
unset($p["test.txt"]);
|
||||
var_dump(isset($p["test.txt"]));
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
$phar['test2.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write17.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write17.phar
Normal file
Binary file not shown.
16
ext/phar/tests/cache_list/files/write17.phar.inc
Normal file
16
ext/phar/tests/cache_list/files/write17.phar.inc
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write17.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getMetadata());
|
||||
$p->setMetadata("hi");
|
||||
var_dump($p->getMetadata());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write18.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write18.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write18.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write18.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write18.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
echo decoct(fileperms("phar://" . __FILE__ . "/test.txt")),"\n";
|
||||
$p["test.txt"]->chmod(0444);
|
||||
echo decoct(fileperms("phar://" . __FILE__ . "/test.txt")),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
$phar["test.txt"]->chmod(0666);
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write19.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write19.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write19.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write19.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write19.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p["test.txt"]->getMetadata());
|
||||
$p["test.txt"]->setMetadata("hi2");
|
||||
var_dump($p["test.txt"]->getMetadata());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
$phar["test.txt"]->setMetadata("hi");
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write20.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write20.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write20.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write20.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write20.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p["test.txt"]->getMetadata());
|
||||
$p["test.txt"]->delMetadata();
|
||||
var_dump($p["test.txt"]->getMetadata());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
$phar["test.txt"]->setMetadata("hi");
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write21.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write21.phar
Normal file
Binary file not shown.
16
ext/phar/tests/cache_list/files/write21.phar.inc
Normal file
16
ext/phar/tests/cache_list/files/write21.phar.inc
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write21.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
$p["test.txt"]->compress(Phar::GZ);
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write22.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write22.phar
Normal file
Binary file not shown.
17
ext/phar/tests/cache_list/files/write22.phar.inc
Normal file
17
ext/phar/tests/cache_list/files/write22.phar.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write22.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
$p["test.txt"]->decompress();
|
||||
var_dump($p["test.txt"]->isCompressed());
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
$phar['test.txt']->compress(Phar::GZ);
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write23.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write23.phar
Normal file
Binary file not shown.
16
ext/phar/tests/cache_list/files/write23.phar.inc
Normal file
16
ext/phar/tests/cache_list/files/write23.phar.inc
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write23.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump(isset($p["test.txt"]), isset($p["newname"]));
|
||||
rename("phar://" . __FILE__ . "/test.txt", "phar://" . __FILE__ . "/newname");
|
||||
var_dump(isset($p["test.txt"]), isset($p["newname"]));
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write24.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write24.phar
Normal file
Binary file not shown.
18
ext/phar/tests/cache_list/files/write24.phar.inc
Normal file
18
ext/phar/tests/cache_list/files/write24.phar.inc
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write24.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump(isset($p["newname"]));
|
||||
$fp = fopen("phar://" . __FILE__ . "/newname", "w");
|
||||
fwrite($fp, "hi");
|
||||
fclose($fp);
|
||||
var_dump(isset($p["newname"]));
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
|
||||
?>
|
Binary file not shown.
BIN
ext/phar/tests/cache_list/files/write4.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write4.phar
Normal file
Binary file not shown.
16
ext/phar/tests/cache_list/files/write4.phar.inc
Normal file
16
ext/phar/tests/cache_list/files/write4.phar.inc
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write4.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
var_dump(file_exists("phar://" . __FILE__ . "/test.txt"));
|
||||
clearstatcache();
|
||||
Phar::mount("test.txt", "phar://" . __FILE__ . "/tobemounted");
|
||||
var_dump(file_exists("phar://" . __FILE__ . "/test.txt"), file_get_contents("phar://" . __FILE__ . "/test.txt"));
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['tobemounted'] = "hi";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write5.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write5.phar
Normal file
Binary file not shown.
27
ext/phar/tests/cache_list/files/write5.phar.inc
Normal file
27
ext/phar/tests/cache_list/files/write5.phar.inc
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write5.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$phar = new Phar(__FILE__);
|
||||
$d = dirname(__FILE__) . "/copyonwrite5";
|
||||
mkdir($d);
|
||||
file_put_contents($d . "/file1", "file1\n");
|
||||
file_put_contents($d . "/file2", "file2\n");
|
||||
var_dump($phar->buildFromDirectory($d));
|
||||
$phar2 = new Phar(__FILE__);
|
||||
$arr = array();
|
||||
foreach ($phar2 as $name => $file) {
|
||||
$arr[$name] = $file->getContent();
|
||||
}
|
||||
asort($arr);
|
||||
foreach ($arr as $name => $content) {
|
||||
echo $name, " ", $content;
|
||||
}
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['hi'] = "hi\n";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write6.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write6.phar
Normal file
Binary file not shown.
27
ext/phar/tests/cache_list/files/write6.phar.inc
Normal file
27
ext/phar/tests/cache_list/files/write6.phar.inc
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write6.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$phar = new Phar(__FILE__);
|
||||
$d = dirname(__FILE__) . "/copyonwrite6";
|
||||
mkdir($d);
|
||||
file_put_contents($d . "/file1", "file1\n");
|
||||
file_put_contents($d . "/file2", "file2\n");
|
||||
var_dump($phar->buildFromIterator(new RecursiveDirectoryIterator($d),$d));
|
||||
$phar2 = new Phar(__FILE__);
|
||||
$arr = array();
|
||||
foreach ($phar2 as $name => $file) {
|
||||
$arr[$name] = $file->getContent();
|
||||
}
|
||||
asort($arr);
|
||||
foreach ($arr as $name => $content) {
|
||||
echo $name, " ", $content;
|
||||
}
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['hi'] = "hi\n";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write7.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write7.phar
Normal file
Binary file not shown.
18
ext/phar/tests/cache_list/files/write7.phar.inc
Normal file
18
ext/phar/tests/cache_list/files/write7.phar.inc
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write7.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump(file_exists("phar://" . __FILE__ . "/test.txt"));
|
||||
$p->delete("test.txt");
|
||||
clearstatcache();
|
||||
var_dump(file_exists("phar://" . __FILE__ . "/test.txt"));
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "hi
|
||||
";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write8.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write8.phar
Normal file
Binary file not shown.
18
ext/phar/tests/cache_list/files/write8.phar.inc
Normal file
18
ext/phar/tests/cache_list/files/write8.phar.inc
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write8.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getAlias());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->setAlias("hi");
|
||||
echo $p2->getAlias(),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "hi
|
||||
";
|
||||
?>
|
BIN
ext/phar/tests/cache_list/files/write9.phar
Normal file
BIN
ext/phar/tests/cache_list/files/write9.phar
Normal file
Binary file not shown.
18
ext/phar/tests/cache_list/files/write9.phar.inc
Normal file
18
ext/phar/tests/cache_list/files/write9.phar.inc
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$fname = dirname(__FILE__) . '/write9.phar';
|
||||
@unlink($fname);
|
||||
|
||||
$phar = new Phar($fname);
|
||||
$phar->setStub('<?php
|
||||
$p = new Phar(__FILE__);
|
||||
var_dump($p->getStub());
|
||||
$p2 = new Phar(__FILE__);
|
||||
$p->setStub("<?php __HALT"."_COMPILER();");
|
||||
echo $p2->getStub(),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER();
|
||||
?>');
|
||||
$phar['test.txt'] = "hi
|
||||
";
|
||||
?>
|
Loading…
Reference in New Issue
Block a user