add complete tests verifying copy-on-write for cached phars

This commit is contained in:
Greg Beaver 2008-10-13 04:21:09 +00:00
parent 5bc1122056
commit 3a54017556
65 changed files with 764 additions and 0 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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===

View 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

View 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

View 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

View 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

View 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

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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);
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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);
?>

Binary file not shown.

View 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");
?>

Binary file not shown.

View 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");
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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);
?>

Binary file not shown.

View 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();";
?>

Binary file not shown.

View 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.

View 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";
?>

Binary file not shown.

View 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";
?>

Binary file not shown.

View 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";
?>

Binary file not shown.

View 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
";
?>

Binary file not shown.

View 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
";
?>

Binary file not shown.

View 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
";
?>