diff options
Diffstat (limited to 'ext/phar/tests/cache_list/files')
102 files changed, 950 insertions, 0 deletions
diff --git a/ext/phar/tests/cache_list/files/blog.phar b/ext/phar/tests/cache_list/files/blog.phar Binary files differnew file mode 100644 index 0000000..58c8a3b --- /dev/null +++ b/ext/phar/tests/cache_list/files/blog.phar diff --git a/ext/phar/tests/cache_list/files/blog.phar.inc b/ext/phar/tests/cache_list/files/blog.phar.inc new file mode 100644 index 0000000..62d86c5 --- /dev/null +++ b/ext/phar/tests/cache_list/files/blog.phar.inc @@ -0,0 +1,20 @@ +<?php + +$fname = dirname(__FILE__) . '/blog.phar'; +@unlink($fname); + +$phar = new Phar($fname); +$phar->setStub('<?php if(file_exists(dirname(__FILE__) . "/files/config.xml")) { + Phar::mount("config.xml", dirname(__FILE__) . "/files/config.xml"); +} +Phar::webPhar("blog", "index.php"); +__HALT_COMPILER(); ?>'); +$phar['index.php'] = '<?php if (!file_exists("config.xml")) { + include "install.php"; + exit; +} +var_dump(file_get_contents("config.xml")); +?>'; +$phar['install.php'] = '<?php echo "install\n"; ?>'; + +?> diff --git a/ext/phar/tests/cache_list/files/config.xml b/ext/phar/tests/cache_list/files/config.xml new file mode 100644 index 0000000..cf0dbc5 --- /dev/null +++ b/ext/phar/tests/cache_list/files/config.xml @@ -0,0 +1,9 @@ +<xml version="1.0" encoding="UTF-8"> +<config> + <database> + <host>localhost</name> + <user>squirrel</user> + <pass>nuts</pass> + <db>hoard</db> + </database> +</config> diff --git a/ext/phar/tests/cache_list/files/extracted.inc b/ext/phar/tests/cache_list/files/extracted.inc new file mode 100644 index 0000000..a6e5224 --- /dev/null +++ b/ext/phar/tests/cache_list/files/extracted.inc @@ -0,0 +1 @@ +<?php var_dump(__FILE__); ?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller.phar b/ext/phar/tests/cache_list/files/frontcontroller.phar Binary files differnew file mode 100644 index 0000000..626bf48 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller.phar.inc new file mode 100644 index 0000000..80d42e8 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller.phar.inc @@ -0,0 +1,13 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a['index.php'] = 'here is my index'; +$a->setStub('<?php +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller10.phar b/ext/phar/tests/cache_list/files/frontcontroller10.phar Binary files differnew file mode 100644 index 0000000..078ce75 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller10.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller10.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller10.phar.inc new file mode 100644 index 0000000..4c139db --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller10.phar.inc @@ -0,0 +1,20 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller10.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller10.phar'); +$a['index.php'] = '<?php +var_dump($_SERVER["PHP_SELF"]); +var_dump($_SERVER["SCRIPT_NAME"]); +var_dump($_SERVER["SCRIPT_FILENAME"]); +var_dump($_SERVER["REQUEST_URI"]); +var_dump($_SERVER["PHAR_PHP_SELF"]); +var_dump($_SERVER["PHAR_SCRIPT_NAME"]); +var_dump($_SERVER["PHAR_SCRIPT_FILENAME"]); +var_dump($_SERVER["PHAR_REQUEST_URI"]); +'; +$a->setStub('<?php +Phar::mungServer(array("PHP_SELF", "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI", "OOPSIE")); +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller11.phar b/ext/phar/tests/cache_list/files/frontcontroller11.phar Binary files differnew file mode 100644 index 0000000..61ea843 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller11.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller11.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller11.phar.inc new file mode 100644 index 0000000..0863508 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller11.phar.inc @@ -0,0 +1,20 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller11.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller11.phar'); +$a['index.php'] = '<?php +var_dump($_SERVER["PHP_SELF"]); +var_dump($_SERVER["SCRIPT_NAME"]); +var_dump($_SERVER["SCRIPT_FILENAME"]); +var_dump($_SERVER["REQUEST_URI"]); +var_dump($_SERVER["PHAR_PHP_SELF"]); +var_dump($_SERVER["PHAR_SCRIPT_NAME"]); +var_dump($_SERVER["PHAR_SCRIPT_FILENAME"]); +var_dump($_SERVER["PHAR_REQUEST_URI"]); +'; +$a->setStub('<?php +Phar::mungServer(array(array(), "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI")); +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller12.phar b/ext/phar/tests/cache_list/files/frontcontroller12.phar Binary files differnew file mode 100644 index 0000000..1cf3629 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller12.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc new file mode 100644 index 0000000..f1e4645 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc @@ -0,0 +1,20 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller12.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller12.phar'); +$a['index.php'] = '<?php +var_dump($_SERVER["PHP_SELF"]); +var_dump($_SERVER[b"SCRIPT_NAME"]); +var_dump($_SERVER[b"SCRIPT_FILENAME"]); +var_dump($_SERVER[b"REQUEST_URI"]); +var_dump($_SERVER[b"PHAR_PHP_SELF"]); +var_dump($_SERVER[b"PHAR_SCRIPT_NAME"]); +var_dump($_SERVER[b"PHAR_SCRIPT_FILENAME"]); +var_dump($_SERVER[b"PHAR_REQUEST_URI"]); +'; +$a->setStub('<?php +Phar::mungServer(array("PHP_SELF", "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI")); +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller13.phar b/ext/phar/tests/cache_list/files/frontcontroller13.phar Binary files differnew file mode 100644 index 0000000..750ff27 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller13.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller13.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller13.phar.inc new file mode 100644 index 0000000..0bfef46 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller13.phar.inc @@ -0,0 +1,14 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller13.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller13.phar'); +$a['index.php'] = '<?php +var_dump("test"); +include "oof/test.php";'; +$a['oof/test.php'] = '<?php +var_dump("oof/test.php"); +include "./hi.php";'; +$a['oof/hi.php'] = '<?php +var_dump("hi");'; +$a->setStub('<?php +Phar::webPhar(); +__HALT_COMPILER();');
\ No newline at end of file diff --git a/ext/phar/tests/cache_list/files/frontcontroller14.phar b/ext/phar/tests/cache_list/files/frontcontroller14.phar Binary files differnew file mode 100644 index 0000000..ebc3e9b --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller14.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc new file mode 100644 index 0000000..23104a6 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc @@ -0,0 +1,19 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller14.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller14.phar'); +$a['html/index.php'] = '<?php +var_dump($_SERVER[b"PATH_INFO"]); +var_dump($_SERVER[b"PATH_TRANSLATED"]); +'; +$a->setStub('<?php +function s($a) +{ + return "/html/index.php"; +} +Phar::interceptFileFuncs(); +Phar::mungServer(array("PHP_SELF", "REQUEST_URI")); +Phar::webPhar("whatever", "/html/index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller16.phar b/ext/phar/tests/cache_list/files/frontcontroller16.phar Binary files differnew file mode 100644 index 0000000..cce5db5 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller16.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc new file mode 100644 index 0000000..3c9986d --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc @@ -0,0 +1,16 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller16.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller16.phar'); +$a['index.php'] = '<?php +echo "hi"; +'; +$a->setStub('<?php +try { +Phar::webPhar("test.phar", "/index.php", null, array(), array("fail", "here")); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller17.phar b/ext/phar/tests/cache_list/files/frontcontroller17.phar Binary files differnew file mode 100644 index 0000000..b83d41f --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller17.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller17.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller17.phar.inc new file mode 100644 index 0000000..85b8729 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller17.phar.inc @@ -0,0 +1,16 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller17.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller17.phar'); +$a['index.php'] = '<?php +echo "hi"; +'; +$a->setStub('<?php +try { +Phar::webPhar("test.phar", "/index.php", null, array(), "sort"); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller18.phar b/ext/phar/tests/cache_list/files/frontcontroller18.phar Binary files differnew file mode 100644 index 0000000..c447f39 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller18.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller18.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller18.phar.inc new file mode 100644 index 0000000..847a713 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller18.phar.inc @@ -0,0 +1,19 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller18.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller18.phar'); +$a['index.php'] = '<?php +echo "hi"; +'; +$a->setStub('<?php +function s($a) +{ +} +try { +Phar::webPhar("test.phar", "/index.php", null, array(), "s"); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller19.phar b/ext/phar/tests/cache_list/files/frontcontroller19.phar Binary files differnew file mode 100644 index 0000000..bdf8ee1 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller19.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller19.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller19.phar.inc new file mode 100644 index 0000000..ba84ac4 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller19.phar.inc @@ -0,0 +1,25 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller19.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller19.phar'); +$a['start/index.php'] = '<?php +echo "start/index.php\n"; +include "./another.php"; +'; +$a['start/another.php'] = '<?php +echo "start/another.php\n"; +include "../another.php"; +?>'; +$a['another.php'] = '<?php +echo "another.php\n"; +?>'; +$a->setStub('<?php +set_include_path("phar://" . __FILE__); +try { +Phar::webPhar("test.phar", "/start/index.php"); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller2.phar b/ext/phar/tests/cache_list/files/frontcontroller2.phar Binary files differnew file mode 100644 index 0000000..0dd0e7f --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller2.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller2.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller2.phar.inc new file mode 100644 index 0000000..653c796 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller2.phar.inc @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller2.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller2.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "a.php"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller3.phar b/ext/phar/tests/cache_list/files/frontcontroller3.phar Binary files differnew file mode 100644 index 0000000..35a23ea --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller3.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc new file mode 100644 index 0000000..6f9126f --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc @@ -0,0 +1,18 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller3.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller3.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +function s($a) +{ + static $b = array(b"/hi" => "a.phps"); + if (isset($b[$a])) return $b[$a]; + return $a; +} +Phar::webPhar("whatever", "/index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller4.phar b/ext/phar/tests/cache_list/files/frontcontroller4.phar Binary files differnew file mode 100644 index 0000000..8359461 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller4.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc new file mode 100644 index 0000000..daf807e --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc @@ -0,0 +1,18 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller4.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller4.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +function s($a) +{ + static $b = array(b"/hi" => false); + if (isset($b[$a])) return $b[$a]; + return $a; +} +Phar::webPhar("whatever", "index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller5.phar b/ext/phar/tests/cache_list/files/frontcontroller5.phar Binary files differnew file mode 100644 index 0000000..f206b59 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller5.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller5.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller5.phar.inc new file mode 100644 index 0000000..d2d810c --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller5.phar.inc @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller5.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller5.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", null, array(0 => "oops")); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller6.phar b/ext/phar/tests/cache_list/files/frontcontroller6.phar Binary files differnew file mode 100644 index 0000000..f4a8265 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller6.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller6.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller6.phar.inc new file mode 100644 index 0000000..5c900eb --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller6.phar.inc @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller6.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller6.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", null, array("blah" => 100)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller7.phar b/ext/phar/tests/cache_list/files/frontcontroller7.phar Binary files differnew file mode 100644 index 0000000..07884b2 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller7.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller7.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller7.phar.inc new file mode 100644 index 0000000..6849702 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller7.phar.inc @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller7.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller7.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", null, array("blah" => null)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller8.phar b/ext/phar/tests/cache_list/files/frontcontroller8.phar Binary files differnew file mode 100644 index 0000000..c9c0e40 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller8.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc new file mode 100644 index 0000000..8629f08 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc @@ -0,0 +1,19 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller8.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar'); +$a['a.phps'] = 'hio1'; +$a['a1.phps'] = '<?php var_dump($_SERVER[b"REQUEST_URI"], $_SERVER[b"PATH_INFO"]);'; +$a['a.jpg'] = 'hio2'; +$a['a.php'] = '<?php function hio(){}'; +$a['fronk.gronk'] = 'hio3'; +$a['404.php'] = 'My 404 is rawesome'; +$a['noext'] = 'hi'; +$a['unknown.ext'] = '<?php var_dump("hi");'; +$a['bigfile.txt'] = str_repeat('a', 8193); +$a['fatalerror.phps'] = '<?php oopsie_daisy();'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", "404.php", array("jpg" => "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/frontcontroller9.phar b/ext/phar/tests/cache_list/files/frontcontroller9.phar Binary files differnew file mode 100644 index 0000000..39ca28c --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller9.phar diff --git a/ext/phar/tests/cache_list/files/frontcontroller9.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller9.phar.inc new file mode 100644 index 0000000..00861f6 --- /dev/null +++ b/ext/phar/tests/cache_list/files/frontcontroller9.phar.inc @@ -0,0 +1,14 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller9.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller9.phar'); +$a['a.phps'] = 'hio1'; +$a['a.jpg'] = 'hio2'; +$a['a.php'] = '<?php function hio(){}'; +$a['fronk.gronk'] = 'hio3'; +$a->setStub('<?php +Phar::mungServer(array()); +Phar::webPhar("whatever", "index.php", null, array("jpg" => "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/cache_list/files/md5.phar b/ext/phar/tests/cache_list/files/md5.phar Binary files differnew file mode 100644 index 0000000..8ca2f84 --- /dev/null +++ b/ext/phar/tests/cache_list/files/md5.phar diff --git a/ext/phar/tests/cache_list/files/nophar.phar b/ext/phar/tests/cache_list/files/nophar.phar Binary files differnew file mode 100644 index 0000000..4eb3083 --- /dev/null +++ b/ext/phar/tests/cache_list/files/nophar.phar diff --git a/ext/phar/tests/cache_list/files/nophar.phar.inc b/ext/phar/tests/cache_list/files/nophar.phar.inc new file mode 100644 index 0000000..36d5628 --- /dev/null +++ b/ext/phar/tests/cache_list/files/nophar.phar.inc @@ -0,0 +1,10 @@ +<?php +$fname = dirname(__FILE__) . '/nophar.phar'; +@unlink($fname); +$p = new Phar($fname); +$p['index.php'] = '<?php include "b/c.php";' . "\n"; +$p['web.php'] = '<?php echo "web\n";'; +$p['b/c.php'] = '<?php echo "in b\n";$a = fopen("index.php", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";'; +$p['d'] = "in d\n"; +$p->setStub($p->createDefaultStub('index.php', 'web.php')); +?>
\ No newline at end of file diff --git a/ext/phar/tests/cache_list/files/openssl.phar b/ext/phar/tests/cache_list/files/openssl.phar Binary files differnew file mode 100644 index 0000000..f3864d7 --- /dev/null +++ b/ext/phar/tests/cache_list/files/openssl.phar diff --git a/ext/phar/tests/cache_list/files/openssl.phar.pubkey b/ext/phar/tests/cache_list/files/openssl.phar.pubkey new file mode 100644 index 0000000..7dd79ac --- /dev/null +++ b/ext/phar/tests/cache_list/files/openssl.phar.pubkey @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDA3ADUiKZIEhekYShzPCZ3LFbg +rDuV44jH94OdJQfqaCQBvZXqMoG1bWOeYfbc3iO0gHWW3SKB27Sf1ZBnc5c1+YzB +mx9bFipOX2W2ouKS2YoHeIoR9leDNu4yqwBsuggFPGVPxM9ikEI+YAOGVTCd4mV5 +agpkVsHLNJWbz/nPVwIDAQAB +-----END PUBLIC KEY----- diff --git a/ext/phar/tests/cache_list/files/phar_oo_test.inc b/ext/phar/tests/cache_list/files/phar_oo_test.inc new file mode 100644 index 0000000..9863e8d --- /dev/null +++ b/ext/phar/tests/cache_list/files/phar_oo_test.inc @@ -0,0 +1,49 @@ +<?php + +ini_set('date.timezone', 'GMT'); + +$fname = dirname(__FILE__) . '/phar_oo_test.phar.php'; +$pname = 'phar://' . $fname; +$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>'; + +$files = array(); + +if (!isset($pharconfig)) $pharconfig = 0; + +switch($pharconfig) +{ + default: + case 0: + $files['a.php'] = '<?php echo "This is a.php\n"; ?>'; + $files['b.php'] = '<?php echo "This is b.php\n"; ?>'; + $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>'; + $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>'; + $files['e.php'] = '<?php echo "This is e.php\n"; ?>'; + break; + case 1: + $files['a.csv'] =<<<EOF +1,2,3 +2,a,b +3,"c","'e'" +EOF; + break; + case 2: + $files['a.csv'] =<<<EOF +1,2,3 +2,a,b +3,"c","'e'" +4 +5,5 + +7,777 +EOF; + break; + case 3: + $files['a.php'] = '<?php echo new new class;'; + break; +} + +$ftime = mktime(12, 0, 0, 3, 1, 2006); +include 'phar_test.inc'; + +?>
\ No newline at end of file diff --git a/ext/phar/tests/cache_list/files/phar_test.inc b/ext/phar/tests/cache_list/files/phar_test.inc new file mode 100644 index 0000000..f82471d --- /dev/null +++ b/ext/phar/tests/cache_list/files/phar_test.inc @@ -0,0 +1,78 @@ +<?php + +if (function_exists('date_default_timezone_set')) { + date_default_timezone_set('UTC'); +} + +$manifest = (binary)''; +$glags = 0; + +foreach($files as $name => $cont) +{ + global $gflags, $files; + + $comp = NULL; + $crc32= NULL; + $clen = NULL; + $ulen = NULL; + $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006); + $flags= 0; + $perm = 0x000001B6; + $meta = NULL; + + // overwrite if array + if (is_array($cont)) + { + foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what) + { + if (isset($cont[$what])) + { + $$what = $cont[$what]; + } + } + } + + // create if not yet done + if (empty($comp)) $comp = $cont; + if (empty($ulen)) $ulen = strlen($cont); + if (empty($clen)) $clen = strlen($comp); + if (empty($crc32))$crc32= crc32((binary)$cont); + if (isset($meta)) $meta = serialize($meta); + + // write manifest entry + $manifest .= pack('V', strlen($name)) . (binary)$name; + $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta; + + // globals + $gflags |= $flags; + $files[$name] = $comp; +} + +if (!isset($alias)) $alias = 'hio'; + +if (isset($pmeta)) $pmeta = serialize($pmeta); else $pmeta = ''; + +$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . (binary)$alias . pack('V', strlen($pmeta)) . (binary)$pmeta . $manifest; +$file = (binary)$file; +$file .= pack('V', strlen($manifest)) . $manifest; + +foreach($files as $cont) +{ + $file .= (binary)$cont; +} + +file_put_contents($fname, $file); + +if (@$gzip) { + $fp = gzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); +} + +if (@$bz2) { + $fp = bzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); +} + +?>
\ No newline at end of file diff --git a/ext/phar/tests/cache_list/files/private.pem b/ext/phar/tests/cache_list/files/private.pem new file mode 100644 index 0000000..e4f4883 --- /dev/null +++ b/ext/phar/tests/cache_list/files/private.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDA3ADUiKZIEhekYShzPCZ3LFbgrDuV44jH94OdJQfqaCQBvZXq +MoG1bWOeYfbc3iO0gHWW3SKB27Sf1ZBnc5c1+YzBmx9bFipOX2W2ouKS2YoHeIoR +9leDNu4yqwBsuggFPGVPxM9ikEI+YAOGVTCd4mV5agpkVsHLNJWbz/nPVwIDAQAB +AoGAGiS4qBbuE48ATXQuO5DH1hfYnxQ575Oskw7mdIL0k74SQ3ojvF+kXae6fVni +UQZ76JgRWKYZa2kRDymwLZXpxVbiGL9dDvQY8ZENDtWOy9s7TDtxNixbZloKBopg +J7G1B05LgetR3dgFnQOwt+e3kOu72RpS7thyBaUm8zHCRSECQQDw+h5uxE7i9CC8 +KHyJlwGoR28KZgrSpo74yWhQ+b1lzxQ+rk2wToFD/p+WNe/nf78YUl/cq0LngCKH +Y7t228VLAkEAzOHzAjuDlGGzK6Kpe67iKgXd+GpKwPr9iaFfmzABOkRwQug4LCN7 +skmzCX5pzxqMZW1xNICjeDjWsMA3d4EypQJBAJyXPA1onYaXc2oxuPPD3/zVJpAQ +TTojp8Z9Qr9T+kJdNV+h7rQB37gqjtOSiynY9nm8lbSUya4bstRd96S+HU8CQQCp +yBAd6H2oZ7IXVeuHACyRUF1ab5LVCukxtVXJ/2T1CSPSfieWhC0MWMCR/HzoUALK +RoBKVtOgW9GllRQh5yG1AkARVYbvj0XBy6XUpe5WZsLNWwpw1JreRsygcPXYh8bs +nxhCdHNHJQ01lRDMjvNLtI8a5YjJE/IeW76T2mPCiJZI +-----END RSA PRIVATE KEY----- diff --git a/ext/phar/tests/cache_list/files/sha1.phar b/ext/phar/tests/cache_list/files/sha1.phar Binary files differnew file mode 100644 index 0000000..c7e9e7e --- /dev/null +++ b/ext/phar/tests/cache_list/files/sha1.phar diff --git a/ext/phar/tests/cache_list/files/sha256.phar b/ext/phar/tests/cache_list/files/sha256.phar Binary files differnew file mode 100644 index 0000000..81459ee --- /dev/null +++ b/ext/phar/tests/cache_list/files/sha256.phar diff --git a/ext/phar/tests/cache_list/files/sha512.phar b/ext/phar/tests/cache_list/files/sha512.phar Binary files differnew file mode 100644 index 0000000..a747381 --- /dev/null +++ b/ext/phar/tests/cache_list/files/sha512.phar diff --git a/ext/phar/tests/cache_list/files/write.phar b/ext/phar/tests/cache_list/files/write.phar Binary files differnew file mode 100644 index 0000000..7acdaa6 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write.phar diff --git a/ext/phar/tests/cache_list/files/write.phar.inc b/ext/phar/tests/cache_list/files/write.phar.inc new file mode 100644 index 0000000..eb722af --- /dev/null +++ b/ext/phar/tests/cache_list/files/write.phar.inc @@ -0,0 +1,20 @@ +<?php + +$fname = dirname(__FILE__) . '/write.phar'; +@unlink($fname); + +$phar = new Phar($fname); +$phar->setStub('<?php +$phar = new Phar(__FILE__); +echo $phar["test.txt"]->getContent(); +$phar["test.txt"] = "changed +"; +echo $phar["test.txt"]->getContent(); +echo "ok\n"; +__HALT_COMPILER(); +?>'); +$phar->setMetadata('hi'); +$phar['test.txt'] = "hi +"; +$phar['test.txt']->setMetadata('hi'); +?> diff --git a/ext/phar/tests/cache_list/files/write10.phar b/ext/phar/tests/cache_list/files/write10.phar Binary files differnew file mode 100644 index 0000000..473f0a1 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write10.phar diff --git a/ext/phar/tests/cache_list/files/write10.phar.inc b/ext/phar/tests/cache_list/files/write10.phar.inc new file mode 100644 index 0000000..a23b5e5 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write10.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write11.phar b/ext/phar/tests/cache_list/files/write11.phar Binary files differnew file mode 100644 index 0000000..bb8d33f --- /dev/null +++ b/ext/phar/tests/cache_list/files/write11.phar diff --git a/ext/phar/tests/cache_list/files/write11.phar.inc b/ext/phar/tests/cache_list/files/write11.phar.inc new file mode 100644 index 0000000..d255264 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write11.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write12.phar b/ext/phar/tests/cache_list/files/write12.phar Binary files differnew file mode 100644 index 0000000..bff1456 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write12.phar diff --git a/ext/phar/tests/cache_list/files/write12.phar.inc b/ext/phar/tests/cache_list/files/write12.phar.inc new file mode 100644 index 0000000..f0c01eb --- /dev/null +++ b/ext/phar/tests/cache_list/files/write12.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write13.phar b/ext/phar/tests/cache_list/files/write13.phar Binary files differnew file mode 100644 index 0000000..46ca14d --- /dev/null +++ b/ext/phar/tests/cache_list/files/write13.phar diff --git a/ext/phar/tests/cache_list/files/write13.phar.inc b/ext/phar/tests/cache_list/files/write13.phar.inc new file mode 100644 index 0000000..e8b6f33 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write13.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write14.phar b/ext/phar/tests/cache_list/files/write14.phar Binary files differnew file mode 100644 index 0000000..4482752 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write14.phar diff --git a/ext/phar/tests/cache_list/files/write14.phar.inc b/ext/phar/tests/cache_list/files/write14.phar.inc new file mode 100644 index 0000000..c2b0448 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write14.phar.inc @@ -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); +?> diff --git a/ext/phar/tests/cache_list/files/write15.phar b/ext/phar/tests/cache_list/files/write15.phar Binary files differnew file mode 100644 index 0000000..c6190b7 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write15.phar diff --git a/ext/phar/tests/cache_list/files/write15.phar.inc b/ext/phar/tests/cache_list/files/write15.phar.inc new file mode 100644 index 0000000..d30f6c8 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write15.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write16.phar b/ext/phar/tests/cache_list/files/write16.phar Binary files differnew file mode 100644 index 0000000..05106ea --- /dev/null +++ b/ext/phar/tests/cache_list/files/write16.phar diff --git a/ext/phar/tests/cache_list/files/write16.phar.inc b/ext/phar/tests/cache_list/files/write16.phar.inc new file mode 100644 index 0000000..b7a1b38 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write16.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write17.phar b/ext/phar/tests/cache_list/files/write17.phar Binary files differnew file mode 100644 index 0000000..52ddb5e --- /dev/null +++ b/ext/phar/tests/cache_list/files/write17.phar diff --git a/ext/phar/tests/cache_list/files/write17.phar.inc b/ext/phar/tests/cache_list/files/write17.phar.inc new file mode 100644 index 0000000..47f5ea3 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write17.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write18.phar b/ext/phar/tests/cache_list/files/write18.phar Binary files differnew file mode 100644 index 0000000..3fc9fe1 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write18.phar diff --git a/ext/phar/tests/cache_list/files/write18.phar.inc b/ext/phar/tests/cache_list/files/write18.phar.inc new file mode 100644 index 0000000..fca867d --- /dev/null +++ b/ext/phar/tests/cache_list/files/write18.phar.inc @@ -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); +?> diff --git a/ext/phar/tests/cache_list/files/write19.phar b/ext/phar/tests/cache_list/files/write19.phar Binary files differnew file mode 100644 index 0000000..9e8b7ee --- /dev/null +++ b/ext/phar/tests/cache_list/files/write19.phar diff --git a/ext/phar/tests/cache_list/files/write19.phar.inc b/ext/phar/tests/cache_list/files/write19.phar.inc new file mode 100644 index 0000000..55115ad --- /dev/null +++ b/ext/phar/tests/cache_list/files/write19.phar.inc @@ -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"); +?> diff --git a/ext/phar/tests/cache_list/files/write2.phar b/ext/phar/tests/cache_list/files/write2.phar Binary files differnew file mode 100644 index 0000000..0941025 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write2.phar diff --git a/ext/phar/tests/cache_list/files/write2.phar.inc b/ext/phar/tests/cache_list/files/write2.phar.inc new file mode 100644 index 0000000..7a4e2e3 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write2.phar.inc @@ -0,0 +1,23 @@ +<?php + +$fname = dirname(__FILE__) . '/write2.phar'; +@unlink($fname); + +$phar = new Phar($fname); +$phar->setStub('<?php +$phar = new Phar(__FILE__); +var_dump($phar->getMetadata()); +mkdir("phar://" . __FILE__ . "/test"); +var_dump(is_dir("phar://" . __FILE__ . "/test")); +$phar2 = new Phar(__FILE__); +var_dump($phar2->getMetadata()); +var_dump(isset($phar["test"])); +var_dump(isset($phar2["test"])); +echo "ok\n"; +__HALT_COMPILER(); +?>'); +$phar->setMetadata('hi'); +$phar['test.txt'] = "hi +"; +$phar['test.txt']->setMetadata('hi'); +?> diff --git a/ext/phar/tests/cache_list/files/write20.phar b/ext/phar/tests/cache_list/files/write20.phar Binary files differnew file mode 100644 index 0000000..6109264 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write20.phar diff --git a/ext/phar/tests/cache_list/files/write20.phar.inc b/ext/phar/tests/cache_list/files/write20.phar.inc new file mode 100644 index 0000000..d356bfb --- /dev/null +++ b/ext/phar/tests/cache_list/files/write20.phar.inc @@ -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"); +?> diff --git a/ext/phar/tests/cache_list/files/write21.phar b/ext/phar/tests/cache_list/files/write21.phar Binary files differnew file mode 100644 index 0000000..fad2165 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write21.phar diff --git a/ext/phar/tests/cache_list/files/write21.phar.inc b/ext/phar/tests/cache_list/files/write21.phar.inc new file mode 100644 index 0000000..79bfb20 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write21.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write22.phar b/ext/phar/tests/cache_list/files/write22.phar Binary files differnew file mode 100644 index 0000000..c3c5ce1 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write22.phar diff --git a/ext/phar/tests/cache_list/files/write22.phar.inc b/ext/phar/tests/cache_list/files/write22.phar.inc new file mode 100644 index 0000000..861cabb --- /dev/null +++ b/ext/phar/tests/cache_list/files/write22.phar.inc @@ -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); +?> diff --git a/ext/phar/tests/cache_list/files/write23.phar b/ext/phar/tests/cache_list/files/write23.phar Binary files differnew file mode 100644 index 0000000..2246f61 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write23.phar diff --git a/ext/phar/tests/cache_list/files/write23.phar.inc b/ext/phar/tests/cache_list/files/write23.phar.inc new file mode 100644 index 0000000..ac92a85 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write23.phar.inc @@ -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();"; +?> diff --git a/ext/phar/tests/cache_list/files/write24.phar b/ext/phar/tests/cache_list/files/write24.phar Binary files differnew file mode 100644 index 0000000..36972f3 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write24.phar diff --git a/ext/phar/tests/cache_list/files/write24.phar.inc b/ext/phar/tests/cache_list/files/write24.phar.inc new file mode 100644 index 0000000..216f7c4 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write24.phar.inc @@ -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, b"hi"); +fclose($fp); +var_dump(isset($p["newname"])); +echo "ok\n"; +__HALT_COMPILER(); +?>'); +$phar['test.txt'] = "<?php __HALT"."_COMPILER();"; +?> diff --git a/ext/phar/tests/cache_list/files/write25.phar b/ext/phar/tests/cache_list/files/write25.phar Binary files differnew file mode 100644 index 0000000..93b301c --- /dev/null +++ b/ext/phar/tests/cache_list/files/write25.phar diff --git a/ext/phar/tests/cache_list/files/write25.phar.inc b/ext/phar/tests/cache_list/files/write25.phar.inc new file mode 100644 index 0000000..60a6978 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write25.phar.inc @@ -0,0 +1,16 @@ +<?php + +$fname = dirname(__FILE__) . '/write25.phar'; +@unlink($fname); + +$phar = new Phar($fname); +$phar->setStub('<?php +$p = new Phar(__FILE__); +var_dump(isset($p["mounted"])); +Phar::mount("mounted", "phar://" . __FILE__ . "/test.txt"); +var_dump(isset($p["mounted"])); +echo $p["mounted"]->getContent(),"\nok\n"; +__HALT_COMPILER(); +?>'); +$phar['test.txt'] = "<?php __HALT"."_COMPILER();"; +?> diff --git a/ext/phar/tests/cache_list/files/write3.phar b/ext/phar/tests/cache_list/files/write3.phar Binary files differnew file mode 100644 index 0000000..5ce4a95 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write3.phar diff --git a/ext/phar/tests/cache_list/files/write3.phar.inc b/ext/phar/tests/cache_list/files/write3.phar.inc new file mode 100644 index 0000000..686c065 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write3.phar.inc @@ -0,0 +1,21 @@ +<?php + +$fname = dirname(__FILE__) . '/write3.phar'; +@unlink($fname); + +$phar = new Phar($fname); +$phar->setStub('<?php +clearstatcache(); +var_dump(file_exists("phar://" . __FILE__ . "/test"), is_dir("phar://" . __FILE__ . "/test")); +rmdir("phar://" . __FILE__ . "/test"); +clearstatcache(); +var_dump(file_exists("phar://" . __FILE__ . "/test"), is_dir("phar://" . __FILE__ . "/test")); +echo "ok\n"; +__HALT_COMPILER(); +?>'); +$phar->setMetadata('hi'); +$phar['test.txt'] = "hi +"; +$phar['test.txt']->setMetadata('hi'); +$phar->addEmptyDir('test'); +?> diff --git a/ext/phar/tests/cache_list/files/write4.phar b/ext/phar/tests/cache_list/files/write4.phar Binary files differnew file mode 100644 index 0000000..c267bab --- /dev/null +++ b/ext/phar/tests/cache_list/files/write4.phar diff --git a/ext/phar/tests/cache_list/files/write4.phar.inc b/ext/phar/tests/cache_list/files/write4.phar.inc new file mode 100644 index 0000000..5b476ed --- /dev/null +++ b/ext/phar/tests/cache_list/files/write4.phar.inc @@ -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"; +?> diff --git a/ext/phar/tests/cache_list/files/write5.phar b/ext/phar/tests/cache_list/files/write5.phar Binary files differnew file mode 100644 index 0000000..52635b4 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write5.phar diff --git a/ext/phar/tests/cache_list/files/write5.phar.inc b/ext/phar/tests/cache_list/files/write5.phar.inc new file mode 100644 index 0000000..5e7b9bb --- /dev/null +++ b/ext/phar/tests/cache_list/files/write5.phar.inc @@ -0,0 +1,29 @@ +<?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"); +$arr = $phar->buildFromDirectory($d); +ksort($arr); +var_dump($arr); +$phar2 = new Phar(__FILE__); +$arr = array(); +foreach ($phar2 as $name => $file) { + $arr[$name] = $file->getContent(); +} +ksort($arr); +foreach ($arr as $name => $content) { + echo $name, " ", $content; +} +echo "ok\n"; +__HALT_COMPILER(); +?>'); +$phar['hi'] = "hi\n"; +?> diff --git a/ext/phar/tests/cache_list/files/write6.phar b/ext/phar/tests/cache_list/files/write6.phar Binary files differnew file mode 100644 index 0000000..e3e4341 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write6.phar diff --git a/ext/phar/tests/cache_list/files/write6.phar.inc b/ext/phar/tests/cache_list/files/write6.phar.inc new file mode 100644 index 0000000..3ba5db3 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write6.phar.inc @@ -0,0 +1,30 @@ +<?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"); +$arr = $phar->buildFromIterator(new RecursiveDirectoryIterator($d, RecursiveDirectoryIterator::SKIP_DOTS),$d); +$arr = $phar->buildFromDirectory($d); +ksort($arr); +var_dump($arr); +$phar2 = new Phar(__FILE__); +$arr = array(); +foreach ($phar2 as $name => $file) { + $arr[$name] = $file->getContent(); +} +ksort($arr); +foreach ($arr as $name => $content) { + echo $name, " ", $content; +} +echo "ok\n"; +__HALT_COMPILER(); +?>'); +$phar['hi'] = "hi\n"; +?> diff --git a/ext/phar/tests/cache_list/files/write7.phar b/ext/phar/tests/cache_list/files/write7.phar Binary files differnew file mode 100644 index 0000000..e5854ec --- /dev/null +++ b/ext/phar/tests/cache_list/files/write7.phar diff --git a/ext/phar/tests/cache_list/files/write7.phar.inc b/ext/phar/tests/cache_list/files/write7.phar.inc new file mode 100644 index 0000000..ef5b8b2 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write7.phar.inc @@ -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 +"; +?> diff --git a/ext/phar/tests/cache_list/files/write8.phar b/ext/phar/tests/cache_list/files/write8.phar Binary files differnew file mode 100644 index 0000000..d5d63be --- /dev/null +++ b/ext/phar/tests/cache_list/files/write8.phar diff --git a/ext/phar/tests/cache_list/files/write8.phar.inc b/ext/phar/tests/cache_list/files/write8.phar.inc new file mode 100644 index 0000000..2b733a7 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write8.phar.inc @@ -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 +"; +?> diff --git a/ext/phar/tests/cache_list/files/write9.phar b/ext/phar/tests/cache_list/files/write9.phar Binary files differnew file mode 100644 index 0000000..c012c17 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write9.phar diff --git a/ext/phar/tests/cache_list/files/write9.phar.inc b/ext/phar/tests/cache_list/files/write9.phar.inc new file mode 100644 index 0000000..ed3e681 --- /dev/null +++ b/ext/phar/tests/cache_list/files/write9.phar.inc @@ -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 +"; +?> diff --git a/ext/phar/tests/cache_list/files/zfapp.tgz b/ext/phar/tests/cache_list/files/zfapp.tgz Binary files differnew file mode 100644 index 0000000..fcaec86 --- /dev/null +++ b/ext/phar/tests/cache_list/files/zfapp.tgz |