]> granicus.if.org Git - php/commitdiff
Make tests/tar in line with tests/zip.
authorSteph Fox <sfox@php.net>
Tue, 12 Feb 2008 16:39:59 +0000 (16:39 +0000)
committerSteph Fox <sfox@php.net>
Tue, 12 Feb 2008 16:39:59 +0000 (16:39 +0000)
73 files changed:
ext/phar/tests/tar/033.phpt
ext/phar/tests/tar/033a.phpt
ext/phar/tests/tar/delete.phpt
ext/phar/tests/tar/delete_in_phar.phpt
ext/phar/tests/tar/delete_in_phar_b.phpt
ext/phar/tests/tar/delete_in_phar_confirm.phpt
ext/phar/tests/tar/frontcontroller.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller1.phar.phpt
ext/phar/tests/tar/frontcontroller10.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller10.phar.phpt
ext/phar/tests/tar/frontcontroller10.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller11.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller11.phar.phpt
ext/phar/tests/tar/frontcontroller11.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller12.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller12.phar.phpt
ext/phar/tests/tar/frontcontroller12.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller13.phar.phpt
ext/phar/tests/tar/frontcontroller14.phar.phpt
ext/phar/tests/tar/frontcontroller15.phar.phpt
ext/phar/tests/tar/frontcontroller16.phar.phpt
ext/phar/tests/tar/frontcontroller17.phar.phpt
ext/phar/tests/tar/frontcontroller18.phar.phpt
ext/phar/tests/tar/frontcontroller19.phar.phpt
ext/phar/tests/tar/frontcontroller2.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller2.phar.phpt
ext/phar/tests/tar/frontcontroller2.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller20.phar.phpt
ext/phar/tests/tar/frontcontroller21.phar.phpt
ext/phar/tests/tar/frontcontroller3.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller3.phar.phpt
ext/phar/tests/tar/frontcontroller3.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller4.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller4.phar.phpt
ext/phar/tests/tar/frontcontroller4.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller5.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller5.phar.phpt
ext/phar/tests/tar/frontcontroller5.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller6.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller6.phar.phpt
ext/phar/tests/tar/frontcontroller6.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller7.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller7.phar.phpt
ext/phar/tests/tar/frontcontroller7.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller8.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller8.phar.phpt
ext/phar/tests/tar/frontcontroller8.phar.tar [deleted file]
ext/phar/tests/tar/frontcontroller9.phar.inc [deleted file]
ext/phar/tests/tar/frontcontroller9.phar.phpt
ext/phar/tests/tar/frontcontroller9.phar.tar [deleted file]
ext/phar/tests/tar/make_invalid_tar.php.inc [deleted file]
ext/phar/tests/tar/open_for_write_existing.phpt
ext/phar/tests/tar/open_for_write_existing_b.phpt
ext/phar/tests/tar/open_for_write_existing_c.phpt
ext/phar/tests/tar/open_for_write_newfile.phpt
ext/phar/tests/tar/open_for_write_newfile_b.phpt
ext/phar/tests/tar/open_for_write_newfile_c.phpt
ext/phar/tests/tar/phar_setalias.phpt
ext/phar/tests/tar/phar_setalias2.phpt
ext/phar/tests/tar/phar_stub_error.phpt
ext/phar/tests/tar/refcount1.phpt
ext/phar/tests/tar/rename.phpt
ext/phar/tests/tar/tar_001.phpt
ext/phar/tests/tar/tar_002.phpt
ext/phar/tests/tar/tar_003.phpt
ext/phar/tests/tar/tar_004.phpt
ext/phar/tests/tar/tar_bz2.phpt
ext/phar/tests/tar/tar_gzip.phpt
ext/phar/tests/tar/tar_makebz2.phpt
ext/phar/tests/tar/tar_makegz.phpt
ext/phar/tests/tar/tar_nostub.phpt
ext/phar/tests/tar/tarmaker.php.inc [deleted file]

index 662e462fa9c4d6c58c30d96a0bc8ba2d6ed642a8..2f4e4b2a4fdbb0f8e9d18bb1ddfcb9a5b6e63ad8 100644 (file)
@@ -7,38 +7,37 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
-$pname = 'phar://hio';
 
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('a.php', '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>');
-$a->addFile('.phar/alias.txt', 'hio');
-$a->mkDir('test');
-$a->close();
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://hio';
+
+$phar = new Phar($fname);
+$phar['a.php'] = '<?php echo "This is a\n"; include "'.$alias.'/b.php"; ?>';
+$phar->setAlias('hio');
+$phar['test/'] = '';
+$phar->stopBuffering();
 
 try {
-       $a = new Phar($fname);
-       var_dump($a['a.php']->isExecutable());
-       $a['a.php']->chmod(0777);
-       var_dump($a['a.php']->isExecutable());
-       $a['a.php']->chmod(0666);
-       var_dump($a['a.php']->isExecutable());
+       var_dump($phar['a.php']->isExecutable());
+       $phar['a.php']->chmod(0777);
+       var_dump($phar['a.php']->isExecutable());
+       $phar['a.php']->chmod(0666);
+       var_dump($phar['a.php']->isExecutable());
        echo "test dir\n";
-       var_dump($a['test']->isReadable());
-       $a['test']->chmod(0000);
-       var_dump($a['test']->isReadable());
-       $a['test']->chmod(0666);
-       var_dump($a['test']->isReadable());
+       var_dump($phar['test']->isReadable());
+       $phar['test']->chmod(0000);
+       var_dump($phar['test']->isReadable());
+       $phar['test']->chmod(0666);
+       var_dump($phar['test']->isReadable());
 } catch (Exception $e) {
        echo $e->getMessage() . "\n";
 }
+
 ?>
 ===DONE===
 --CLEAN--
 <?php 
-unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
 ?>
 --EXPECTF--
 bool(false)
index 469dbfb94c47e560c3f7b429e429fcf130cb2dbb..92c089faa9c65b1ddbbabcdbd5d655252518d004 100644 (file)
@@ -3,34 +3,33 @@ Phar::chmod tar-based
 --SKIPIF--
 <?php if (!extension_loaded("phar")) die("skip"); ?>
 --INI--
-phar.readonly=1
+phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
-$pname = 'phar://hio';
 
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('a.php', '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>');
-$a->addFile('.phar/alias.txt', 'hio');
-$a->mkDir('test');
-$a->close();
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://hio';
+
+$phar = new Phar($fname);
+$phar['a.php'] = '<?php echo "This is a\n"; include "'.$alias.'/b.php"; ?>';
+$phar->setAlias('hio');
+$phar['test/'] = '';
+$phar->stopBuffering();
+ini_set('phar.readonly', 1);
 
 try {
-       $a = new Phar($fname);
-       var_dump($a['a.php']->isExecutable());
-       $a['a.php']->chmod(0777);
-       var_dump($a['a.php']->isExecutable());
-       $a['a.php']->chmod(0666);
-       var_dump($a['a.php']->isExecutable());
+       var_dump($phar['a.php']->isExecutable());
+       $phar['a.php']->chmod(0777);
+       var_dump($phar['a.php']->isExecutable());
+       $phar['a.php']->chmod(0666);
+       var_dump($phar['a.php']->isExecutable());
        echo "test dir\n";
-       var_dump($a['test']->isExecutable());
-       $a['test']->chmod(0777);
-       var_dump($a['test']->isExecutable());
-       $a['test']->chmod(0666);
-       var_dump($a['test']->isExecutable());
+       var_dump($phar['test']->isReadable());
+       $phar['test']->chmod(0000);
+       var_dump($phar['test']->isReadable());
+       $phar['test']->chmod(0666);
+       var_dump($phar['test']->isReadable());
 } catch (Exception $e) {
        echo $e->getMessage() . "\n";
 }
@@ -38,9 +37,9 @@ try {
 ===DONE===
 --CLEAN--
 <?php 
-unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
 ?>
 --EXPECTF--
 bool(false)
-Cannot modify permissions for file "a.php" in phar "%s033a.1.phar.php", write operations are prohibited
+Cannot modify permissions for file "a.php" in phar "%s033a.phar.tar", write operations are prohibited
 ===DONE===
index 9e94116af429a173710a724179b1e1c9c27166e8..32b2b1e28b3347f5167df516c0ab70fb783f7a99 100644 (file)
@@ -7,28 +7,26 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
-$file = "<?php
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+$stub = "<?php
 Phar::mapPhar('hio');
 __HALT_COMPILER(); ?>";
 
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('a', 'a');
-$a->addFile('.phar/stub.php', $file);
-$a->close();
-
 $phar = new Phar($fname);
+$phar['a'] = 'a';
+$phar->setStub($stub);
+$phar->stopBuffering();
 
-echo file_get_contents($pname . '/a') . "\n";
+echo file_get_contents($alias . '/a') . "\n";
 $phar->delete('a');
-echo file_get_contents($pname . '/a') . "\n";
+echo file_get_contents($alias . '/a') . "\n";
+
 ?>
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 a
 
-Warning: file_get_contents(phar://%sdelete.phar.php/a): failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.php" in %sdelete.php on line %d
\ No newline at end of file
+Warning: file_get_contents(phar://%sdelete.phar.tar/a): failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.tar" in %sdelete.php on line %d
\ No newline at end of file
index 6cf539599cd7a9bb699e769e7c9ee7dfd630a4e0..91ef4a204624ca11aa0ed23453e31d4c2e1ac684 100644 (file)
@@ -7,33 +7,33 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
-
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('a.php', '<?php echo "This is a\n"; ?>');
-$a->addFile('b.php', '<?php echo "This is b\n"; ?>');
-$a->addFile('b/c.php', '<?php echo "This is b/c\n"; ?>');
-$a->addFile('.phar/stub.php', '<?php __HALT_COMPILER(); ?>');
-$a->close();
-
-include $pname . '/a.php';
-include $pname . '/b.php';
-include $pname . '/b/c.php';
-unlink($pname . '/b/c.php');
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar['a.php'] = '<?php echo "This is a\n"; ?>';
+$phar['b.php'] = '<?php echo "This is b\n"; ?>';
+$phar['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+$phar->setStub('<?php __HALT_COMPILER(); ?>');
+$phar->stopBuffering();
+
+include $alias . '/a.php';
+include $alias . '/b.php';
+include $alias . '/b/c.php';
+unlink($alias . '/b/c.php');
+
 ?>
 ===AFTER===
 <?php
-include $pname . '/a.php';
-include $pname . '/b.php';
-include $pname . '/b/c.php';
+include $alias . '/a.php';
+include $alias . '/b.php';
+include $alias . '/b/c.php';
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 This is a
 This is b
@@ -42,9 +42,8 @@ This is b/c
 This is a
 This is b
 
-Warning: include(%sdelete_in_phar.phar.php/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.php" in %sdelete_in_phar.php on line %d
+Warning: include(%sdelete_in_phar.phar.tar/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.tar" in %sdelete_in_phar.php on line %d
 
-Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d
+Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.tar/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d
 
 ===DONE===
-               
\ No newline at end of file
index 937e69b0157ee6feedb8253f141d3f955e8bdb6a..2af1c66debdbf80d65877b2d67774dd63dd61f50 100644 (file)
@@ -3,37 +3,38 @@ Phar: delete a file within a tar-based .phar
 --SKIPIF--
 <?php if (!extension_loaded("phar")) die("skip"); ?>
 --INI--
-phar.readonly=1
+phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
 
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('a.php', '<?php echo "This is a\n"; ?>');
-$a->addFile('b.php', '<?php echo "This is b\n"; ?>');
-$a->addFile('b/c.php', '<?php echo "This is b/c\n"; ?>');
-$a->addFile('.phar/stub.php', '<?php __HALT_COMPILER(); ?>');
-$a->close();
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar['a.php'] = '<?php echo "This is a\n"; ?>';
+$phar['b.php'] = '<?php echo "This is b\n"; ?>';
+$phar['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+$phar->setStub('<?php __HALT_COMPILER(); ?>');
+$phar->stopBuffering();
+ini_set('phar.readonly', 1);
+
+include $alias . '/a.php';
+include $alias . '/b.php';
+include $alias . '/b/c.php';
+unlink($alias . '/b/c.php');
 
-include $pname . '/a.php';
-include $pname . '/b.php';
-include $pname . '/b/c.php';
-unlink($pname . '/b/c.php');
 ?>
 ===AFTER===
 <?php
-include $pname . '/a.php';
-include $pname . '/b.php';
-include $pname . '/b/c.php';
+include $alias . '/a.php';
+include $alias . '/b.php';
+include $alias . '/b/c.php';
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 This is a
 This is b
index 971e40d90d2b355b0915b0e8257ab6e1ed012691..707bcbd0eda49baf5ebe88a6cc1d1d24e73d2de4 100644 (file)
@@ -7,36 +7,36 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
 
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('a.php', '<?php echo "This is a\n"; ?>');
-$a->addFile('b.php', '<?php echo "This is b\n"; ?>');
-$a->addFile('b/c.php', '<?php echo "This is b/c\n"; ?>');
-$a->addFile('.phar/stub.php', '<?php __HALT_COMPILER(); ?>');
-$a->close();
-include $pname . '/a.php';
-include $pname . '/b.php';
-include $pname . '/b/c.php';
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar['a.php'] = '<?php echo "This is a\n"; ?>';
+$phar['b.php'] = '<?php echo "This is b\n"; ?>';
+$phar['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+$phar->setStub('<?php __HALT_COMPILER(); ?>');
+$phar->stopBuffering();
+
+include $alias . '/a.php';
+include $alias . '/b.php';
+include $alias . '/b/c.php';
 $md5 = md5_file($fname);
-unlink($pname . '/b/c.php');
+unlink($alias . '/b/c.php');
 clearstatcache();
 $md52 = md5_file($fname);
 if ($md5 == $md52) echo 'file was not modified';
 ?>
 ===AFTER===
 <?php
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
+include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar/a.php';
+include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar/b.php';
+include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar/b/c.php';
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 This is a
 This is b
@@ -45,8 +45,8 @@ This is b/c
 This is a
 This is b
 
-Warning: include(%sdelete_in_phar_confirm.phar.php/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.php" in %sdelete_in_phar_confirm.php on line %d
+Warning: include(%sdelete_in_phar_confirm.phar.tar/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.tar" in %sdelete_in_phar_confirm.php on line %d
 
-Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
+Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.tar/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
 
 ===DONE===
diff --git a/ext/phar/tests/tar/frontcontroller.phar.inc b/ext/phar/tests/tar/frontcontroller.phar.inc
deleted file mode 100644 (file)
index 6f426e8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller.phar.tar');
-$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/tar/frontcontroller.phar.tar b/ext/phar/tests/tar/frontcontroller.phar.tar
deleted file mode 100644 (file)
index 522d097..0000000
Binary files a/ext/phar/tests/tar/frontcontroller.phar.tar and /dev/null differ
index 79699678f27e7bf1d24e3c61aeb434dacfc08ae2..77158169bbb4653da07215122f9a2647877ed27a 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller1.phar.php
 REQUEST_URI=/frontcontroller1.phar.php/a.jpg
 PATH_INFO=/a.jpg
 --FILE_EXTERNAL--
-frontcontroller.phar.tar
+files/frontcontroller.phar.tar
 --EXPECTHEADERS--
 Content-type: image/jpeg
 Content-length: 3
diff --git a/ext/phar/tests/tar/frontcontroller10.phar.inc b/ext/phar/tests/tar/frontcontroller10.phar.inc
deleted file mode 100644 (file)
index 5b132fa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller10.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller10.phar.tar');
-$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();');
-?>
index fbbe312d1ea20a158422fe044b66c5702d4dd2cf..0ca67b3d3eab41a6679c9e48d392e56bc6bb7815 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller10.phar.php
 REQUEST_URI=/frontcontroller10.phar.php/hi
 PATH_INFO=/hi
 --FILE_EXTERNAL--
-frontcontroller4.phar.tar
+files/frontcontroller4.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 Status: 403 Access Denied
diff --git a/ext/phar/tests/tar/frontcontroller10.phar.tar b/ext/phar/tests/tar/frontcontroller10.phar.tar
deleted file mode 100644 (file)
index d43ed91..0000000
Binary files a/ext/phar/tests/tar/frontcontroller10.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller11.phar.inc b/ext/phar/tests/tar/frontcontroller11.phar.inc
deleted file mode 100644 (file)
index 2fa15f0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller11.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller11.phar.tar');
-$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();');
-?>
index 472abc30265ddda542ea826adc4e716d07139850..697718cc692e6e4686beaaa136dee9ed0b1d1e85 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller11.phar.php
 REQUEST_URI=/frontcontroller11.phar.php/a.php
 PATH_INFO=/a.php
 --FILE_EXTERNAL--
-frontcontroller5.phar.tar
+files/frontcontroller5.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECTF--
diff --git a/ext/phar/tests/tar/frontcontroller11.phar.tar b/ext/phar/tests/tar/frontcontroller11.phar.tar
deleted file mode 100644 (file)
index c8f98a1..0000000
Binary files a/ext/phar/tests/tar/frontcontroller11.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller12.phar.inc b/ext/phar/tests/tar/frontcontroller12.phar.inc
deleted file mode 100644 (file)
index 693ef0a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller12.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller12.phar.tar');
-$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"));
-Phar::webPhar();
-echo "oops did not run\n";
-var_dump($_ENV, $_SERVER);
-__HALT_COMPILER();');
-?>
index e49a633bfad216b4448d3a7fdfdb1b3fae7c4fd3..91095869328c990bd10e2b42b234836042a62c7e 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller12.phar.php
 REQUEST_URI=/frontcontroller12.phar.php/a.php
 PATH_INFO=/a.php
 --FILE_EXTERNAL--
-frontcontroller6.phar.tar
+files/frontcontroller6.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECTF--
diff --git a/ext/phar/tests/tar/frontcontroller12.phar.tar b/ext/phar/tests/tar/frontcontroller12.phar.tar
deleted file mode 100644 (file)
index 06e7e59..0000000
Binary files a/ext/phar/tests/tar/frontcontroller12.phar.tar and /dev/null differ
index c90a2cc9c1eccaa0d4660d2c16ed14445ec31e1c..974145b830847b51bfdede674dd1f3145bb3e30f 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller13.phar.php
 REQUEST_URI=/frontcontroller13.phar.php/a.php
 PATH_INFO=/a.php
 --FILE_EXTERNAL--
-frontcontroller7.phar.tar
+files/frontcontroller7.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECTF--
index 90ee6fd7577c87ed29a773601af8ab8f824d306d..c40f9b6c34fb3d77c42a61930bc04eec86e6ec42 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller14.phar.php
 REQUEST_URI=/frontcontroller14.phar.php/a.jpg
 PATH_INFO=/a.jpg
 --FILE_EXTERNAL--
-frontcontroller8.phar.tar
+files/frontcontroller8.phar.tar
 --EXPECTHEADERS--
 Content-type: foo/bar
 Content-length: 4
index 66911f373f6f43df5b0148f3563301459c6641c8..154117fda45dc063d1d509aba661345d8bff2098 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller15.phar.php
 REQUEST_URI=/frontcontroller15.phar.php/a.php
 PATH_INFO=/a.php
 --FILE_EXTERNAL--
-frontcontroller8.phar.tar
+files/frontcontroller8.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECT--
index 381336a29c5dd486e2bd5b372bd3468c98bd986a..042a695eb3678ee547299e46791113f4c0e53c6f 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller16.phar.php
 REQUEST_URI=/frontcontroller16.phar.php/a.phps
 PATH_INFO=/a.phps
 --FILE_EXTERNAL--
-frontcontroller8.phar.tar
+files/frontcontroller8.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECT--
index 639f8b7d7f3e4c2a2dd443fb893e3c4bc51a01c2..17d04baf309dfeadc9fabc9e2fc5a3b4b0a3773d 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller17.phar.php
 REQUEST_URI=/frontcontroller17.phar.php/fronk.gronk
 PATH_INFO=/fronk.gronk
 --FILE_EXTERNAL--
-frontcontroller8.phar.tar
+files/frontcontroller8.phar.tar
 --EXPECTHEADERS--
 Content-type: application/octet-stream
 Content-length: 4
index eb9875ca6f579eb447303b1afb753ebfe8987f6c..4ecb69a1389a5caf722985390cf79b3e76df5041 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller18.phar.php
 REQUEST_URI=/frontcontroller18.phar.php/fronk.gronk
 PATH_INFO=/fronk.gronk
 --FILE_EXTERNAL--
-frontcontroller9.phar.tar
+files/frontcontroller9.phar.tar
 --EXPECTF--
 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'No values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME' in %sfrontcontroller18.phar.php:2
 Stack trace:
index 9f52f8824f0fb163a4a827c34e8774a456594a7b..2cba4a9a56b389c3d00a2fe25079e5d62974f37d 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller19.phar.php
 REQUEST_URI=/frontcontroller19.phar.php/
 PATH_INFO=/
 --FILE_EXTERNAL--
-frontcontroller10.phar.tar
+files/frontcontroller10.phar.tar
 --EXPECTF--
 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Too many values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME' in %sfrontcontroller19.phar.php:2
 Stack trace:
diff --git a/ext/phar/tests/tar/frontcontroller2.phar.inc b/ext/phar/tests/tar/frontcontroller2.phar.inc
deleted file mode 100644 (file)
index 8ae1171..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller2.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller2.phar.tar');
-$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();');
-?>
index 92b9665ba20c2baf96423c7307cd9291835b0517..a6b1c780fdb0c23ab2e0a6a4a05a5e9a636f96e0 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller2.phar.php
 REQUEST_URI=/frontcontroller2.phar.php/a.php
 PATH_INFO=/a.php
 --FILE_EXTERNAL--
-frontcontroller.phar.tar
+files/frontcontroller.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECT--
diff --git a/ext/phar/tests/tar/frontcontroller2.phar.tar b/ext/phar/tests/tar/frontcontroller2.phar.tar
deleted file mode 100644 (file)
index 857b116..0000000
Binary files a/ext/phar/tests/tar/frontcontroller2.phar.tar and /dev/null differ
index 3a83efb72fe47e28a2125d7d7f8247523fb338f0..42ec810aee5147f34e49ed8e3a62a1abd4a31cf7 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller20.phar.php
 REQUEST_URI=/frontcontroller20.phar.php/
 PATH_INFO=/
 --FILE_EXTERNAL--
-frontcontroller11.phar.tar
+files/frontcontroller11.phar.tar
 --EXPECTF--
 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME' in %sfrontcontroller20.phar.php:2
 Stack trace:
index 2313cbba75aead667b32aa77f6cf1ad17e13e773..eb21897226a0f2c18f4439c08c2d98778a63daad 100644 (file)
@@ -8,7 +8,7 @@ REQUEST_URI=/frontcontroller21.phar.php/index.php?test=hi
 PATH_INFO=/index.php
 QUERY_STRING=test=hi
 --FILE_EXTERNAL--
-frontcontroller12.phar.tar
+files/frontcontroller12.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECTF--
diff --git a/ext/phar/tests/tar/frontcontroller3.phar.inc b/ext/phar/tests/tar/frontcontroller3.phar.inc
deleted file mode 100644 (file)
index 9729d00..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller3.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller3.phar.tar');
-$a['a.php'] = 'hio';
-$a['a.jpg'] = 'hio';
-$a['a.phps'] = '<?php function hio(){}';
-$a->setStub('<?php
-function s($a)
-{
-    static $b = array("/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();');
-?>
index 9980ea2d29c601151155bc71f985bbbdf607b9fe..dee16ee2b2c944b8600d52e32ab7f0933dd799d0 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller3.phar.php
 REQUEST_URI=/frontcontroller3.phar.php/a.phps
 PATH_INFO=/a.phps
 --FILE_EXTERNAL--
-frontcontroller.phar.tar
+files/frontcontroller.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECT--
diff --git a/ext/phar/tests/tar/frontcontroller3.phar.tar b/ext/phar/tests/tar/frontcontroller3.phar.tar
deleted file mode 100644 (file)
index f733884..0000000
Binary files a/ext/phar/tests/tar/frontcontroller3.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller4.phar.inc b/ext/phar/tests/tar/frontcontroller4.phar.inc
deleted file mode 100644 (file)
index eb1d56f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller4.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller4.phar.tar');
-$a['a.php'] = 'hio';
-$a['a.jpg'] = 'hio';
-$a['a.phps'] = '<?php function hio(){}';
-$a->setStub('<?php
-function s($a)
-{
-    static $b = array("/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();');
-?>
index da16c389c665fa717527932dc0fbfee08b9b1643..db4846c69b19c3d4cab670b65995c2c14cede661 100644 (file)
@@ -6,7 +6,7 @@ Phar front controller index.php relocate (no /) tar-based
 SCRIPT_NAME=/frontcontroller4.phar.php
 REQUEST_URI=/frontcontroller4.phar.php
 --FILE_EXTERNAL--
-frontcontroller.phar.tar
+files/frontcontroller.phar.tar
 --EXPECTHEADERS--
 Status: 301 Moved Permanently
 Location: /frontcontroller4.phar.php/index.php
diff --git a/ext/phar/tests/tar/frontcontroller4.phar.tar b/ext/phar/tests/tar/frontcontroller4.phar.tar
deleted file mode 100644 (file)
index 5d11af4..0000000
Binary files a/ext/phar/tests/tar/frontcontroller4.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller5.phar.inc b/ext/phar/tests/tar/frontcontroller5.phar.inc
deleted file mode 100644 (file)
index d6204c7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller5.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller5.phar.tar');
-$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();');
-?>
index a8c122b834afe066ff44e11e5e4024b10aba0b79..534e66a1e324b5342f9a5583fca79ec2110c71b9 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller5.phar.php
 REQUEST_URI=/frontcontroller5.phar.php/
 PATH_INFO=/
 --FILE_EXTERNAL--
-frontcontroller.phar.tar
+files/frontcontroller.phar.tar
 --EXPECTHEADERS--
 Status: 301 Moved Permanently
 Location: /frontcontroller5.phar.php/index.php
diff --git a/ext/phar/tests/tar/frontcontroller5.phar.tar b/ext/phar/tests/tar/frontcontroller5.phar.tar
deleted file mode 100644 (file)
index e6e9015..0000000
Binary files a/ext/phar/tests/tar/frontcontroller5.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller6.phar.inc b/ext/phar/tests/tar/frontcontroller6.phar.inc
deleted file mode 100644 (file)
index 66212d8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller6.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller6.phar.tar');
-$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();');
-?>
index 313630929b3b1e80d94dc193a5c7e130591619a6..5375beef8cc8bd8742ac4477e97e707e365ae402 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller6.phar.php
 REQUEST_URI=/frontcontroller6.phar.php/notfound.php
 PATH_INFO=/notfound.php
 --FILE_EXTERNAL--
-frontcontroller.phar.tar
+files/frontcontroller.phar.tar
 --EXPECTHEADERS--
 Status: 404 Not Found
 --EXPECT--
diff --git a/ext/phar/tests/tar/frontcontroller6.phar.tar b/ext/phar/tests/tar/frontcontroller6.phar.tar
deleted file mode 100644 (file)
index d30b7ab..0000000
Binary files a/ext/phar/tests/tar/frontcontroller6.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller7.phar.inc b/ext/phar/tests/tar/frontcontroller7.phar.inc
deleted file mode 100644 (file)
index 74adf2c..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller7.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller7.phar.tar');
-$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();');
-?>
index b15ca07ff42a2423d1b4806c9c11fbfdeb646e61..3b73f2075c82b2e2e8746381928792086508e78b 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller7.phar.php
 REQUEST_URI=/frontcontroller7.phar.php/
 PATH_INFO=/
 --FILE_EXTERNAL--
-frontcontroller2.phar.tar
+files/frontcontroller2.phar.tar
 --EXPECTHEADERS--
 Status: 301 Moved Permanently
 Location: /frontcontroller7.phar.php/a.php
diff --git a/ext/phar/tests/tar/frontcontroller7.phar.tar b/ext/phar/tests/tar/frontcontroller7.phar.tar
deleted file mode 100644 (file)
index c7ccc94..0000000
Binary files a/ext/phar/tests/tar/frontcontroller7.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller8.phar.inc b/ext/phar/tests/tar/frontcontroller8.phar.inc
deleted file mode 100644 (file)
index f51a762..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller8.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar.tar');
-$a['a.phps'] = 'hio1';
-$a['a.jpg'] = 'hio2';
-$a['a.php'] = '<?php function hio(){}';
-$a['fronk.gronk'] = 'hio3';
-$a->setStub('<?php
-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();');
-?>
index 0f6f50c70017fac067ca62e4c4e478c7e93ba437..19844cb19942d03d5769bb896a6e775a62465403 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller8.phar.php
 REQUEST_URI=/frontcontroller8.phar.php/
 PATH_INFO=/
 --FILE_EXTERNAL--
-frontcontroller3.phar.tar
+files/frontcontroller3.phar.tar
 --EXPECTHEADERS--
 Status: 404 Not Found
 --EXPECT--
diff --git a/ext/phar/tests/tar/frontcontroller8.phar.tar b/ext/phar/tests/tar/frontcontroller8.phar.tar
deleted file mode 100644 (file)
index 9849571..0000000
Binary files a/ext/phar/tests/tar/frontcontroller8.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/frontcontroller9.phar.inc b/ext/phar/tests/tar/frontcontroller9.phar.inc
deleted file mode 100644 (file)
index 758ce4f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-@unlink(dirname(__FILE__) . '/frontcontroller9.phar.tar');
-$a = new Phar(dirname(__FILE__) . '/frontcontroller9.phar.tar');
-$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();');
-?>
index 93540a68b4af00a09fa0ed0b5747610887071a8c..080db58f8fbba43a754c157100ad86e9c2064842 100644 (file)
@@ -7,7 +7,7 @@ SCRIPT_NAME=/frontcontroller9.phar.php
 REQUEST_URI=/frontcontroller9.phar.php/hi
 PATH_INFO=/hi
 --FILE_EXTERNAL--
-frontcontroller3.phar.tar
+files/frontcontroller3.phar.tar
 --EXPECTHEADERS--
 Content-type: text/html
 --EXPECT--
diff --git a/ext/phar/tests/tar/frontcontroller9.phar.tar b/ext/phar/tests/tar/frontcontroller9.phar.tar
deleted file mode 100644 (file)
index 481864c..0000000
Binary files a/ext/phar/tests/tar/frontcontroller9.phar.tar and /dev/null differ
diff --git a/ext/phar/tests/tar/make_invalid_tar.php.inc b/ext/phar/tests/tar/make_invalid_tar.php.inc
deleted file mode 100644 (file)
index c18bd19..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-class corrupter extends tarmaker {
-function close()
-{
-       fwrite($this->tmp, 'oopsie');
-       fclose($this->tmp);
-}
-}
\ No newline at end of file
index 8e57d10f449eae559e0346e7bcddcaef190ffc4c..641e5ce21d6bc15ac945226de2fd76d5b6defaaa 100644 (file)
@@ -7,31 +7,36 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar->setStub("<?php __HALT_COMPILER(); ?>");
 
 $files = array();
+
 $files['a.php'] = '<?php echo "This is a\n"; ?>';
 $files['b.php'] = '<?php echo "This is b\n"; ?>';
 $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
 
-$fp = fopen($pname . '/b/c.php', 'wb');
+$phar->stopBuffering();
+
+$fp = fopen($alias . '/b/c.php', 'wb');
 fwrite($fp, 'extra');
 fclose($fp);
-include $pname . '/b/c.php';
+
+include $alias . '/b/c.php';
+
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECT--
 extra
 ===DONE===
index e4621334314410952f90d530cc3e1901fb40dfc4..54ec5855fb2649c1d97ffc4103c4ec8ce60c404b 100755 (executable)
@@ -3,46 +3,54 @@ Phar: fopen a .phar for writing (existing file) tar-based
 --SKIPIF--
 <?php if (!extension_loaded("phar")) die("skip"); ?>
 --INI--
-phar.readonly=1
+phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar->setStub("<?php __HALT_COMPILER(); ?>");
 
 $files = array();
+
 $files['a.php'] = '<?php echo "This is a\n"; ?>';
 $files['b.php'] = '<?php echo "This is b\n"; ?>';
 $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
+
+$phar->stopBuffering();
+ini_set('phar.readonly', 1);
 
 function err_handler($errno, $errstr, $errfile, $errline) {
-  echo "Catchable fatal error: $errstr in $errfile on line $errline\n";
+       echo "Catchable fatal error: $errstr in $errfile on line $errline\n";
 }
 
 set_error_handler("err_handler", E_RECOVERABLE_ERROR);
 
-$fp = fopen($pname . '/b/c.php', 'wb');
+$fp = fopen($alias . '/b/c.php', 'wb');
 fwrite($fp, 'extra');
 fclose($fp);
-include $pname . '/b/c.php';
+
+include $alias . '/b/c.php';
+
 ?>
+
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 
-Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d
 
-Warning: fwrite(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d
+Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_b.php on line %d
 
 Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d
 This is b/c
-===DONE===
\ No newline at end of file
+
+===DONE===
index b73e9e4200131af24fb57510de040fd59fb22df9..0e5a181e65577a079f2a3042fda59edc1088cf97 100755 (executable)
@@ -3,40 +3,48 @@ Phar: fopen a .phar for writing (existing file) tar-based
 --SKIPIF--
 <?php if (!extension_loaded("phar")) die("skip"); ?>
 --INI--
-phar.readonly=1
+phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar->setStub("<?php __HALT_COMPILER(); ?>");
 
 $files = array();
+
 $files['a.php'] = '<?php echo "This is a\n"; ?>';
 $files['b.php'] = '<?php echo "This is b\n"; ?>';
 $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
 
-$fp = fopen($pname . '/b/c.php', 'wb');
+$phar->stopBuffering();
+ini_set('phar.readonly', 1);
+
+$fp = fopen($alias . '/b/c.php', 'wb');
 fwrite($fp, 'extra');
 fclose($fp);
-include $pname . '/b/c.php';
+
+include $alias . '/b/c.php';
+
 ?>
+
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 
-Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d
 
 Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d
 
 Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d
 This is b/c
-===DONE===
\ No newline at end of file
+
+===DONE===
index 904f245b058e708349b254eaf3cdbf916142bbc7..31e9d4a7e91eb482dd64f47ccd7eb0097ac1dd43 100644 (file)
@@ -7,32 +7,37 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar->setStub("<?php __HALT_COMPILER(); ?>");
 
 $files = array();
+
 $files['a.php'] = '<?php echo "This is a\n"; ?>';
 $files['b.php'] = '<?php echo "This is b\n"; ?>';
 $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
 
-$fp = fopen($pname . '/b/new.php', 'wb');
+$phar->stopBuffering();
+
+$fp = fopen($alias . '/b/new.php', 'wb');
 fwrite($fp, 'extra');
 fclose($fp);
-include $pname . '/b/c.php';
-include $pname . '/b/new.php';
+
+include $alias . '/b/c.php';
+include $alias . '/b/new.php';
+
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECT--
 This is b/c
 extra
index 129d54ae85c42d9562cc8158b2a3b24197aa810b..d3a21b4caf74aafa0c5602ece8a547e0d6395f48 100755 (executable)
@@ -3,53 +3,59 @@ Phar: fopen a .phar for writing (new file) tar-based
 --SKIPIF--
 <?php if (!extension_loaded("phar")) die("skip"); ?>
 --INI--
-phar.readonly=1
+phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar->setStub("<?php __HALT_COMPILER(); ?>");
 
 $files = array();
+
 $files['a.php'] = '<?php echo "This is a\n"; ?>';
 $files['b.php'] = '<?php echo "This is b\n"; ?>';
 $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
+
+$phar->stopBuffering();
+ini_set('phar.readonly', 1);
 
 function err_handler($errno, $errstr, $errfile, $errline) {
-  echo "Catchable fatal error: $errstr in $errfile on line $errline\n";
+       echo "Catchable fatal error: $errstr in $errfile on line $errline\n";
 }
 
 set_error_handler("err_handler", E_RECOVERABLE_ERROR);
 
-$fp = fopen($pname . '/b/new.php', 'wb');
+$fp = fopen($alias . '/b/new.php', 'wb');
 fwrite($fp, 'extra');
 fclose($fp);
-include $pname . '/b/c.php';
-include $pname . '/b/new.php';
+
+include $alias . '/b/c.php';
+include $alias . '/b/new.php';
+
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 
-Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d
 
 Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d
 
 Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d
 This is b/c
 
-Warning: include(phar://%sopen_for_write_newfile_b.phar.tar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar.php" in %sopen_for_write_newfile_b.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar" in %sopen_for_write_newfile_b.php on line %d
 
-Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.tar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d
+Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.tar/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d
 
 ===DONE===
index f7b1ef7eee5bcc6cb534e3e40e571ee0893d775f..231241c8adec33153a3565be452d28068e8271e8 100755 (executable)
@@ -3,47 +3,52 @@ Phar: fopen a .phar for writing (new file) tar-based
 --SKIPIF--
 <?php if (!extension_loaded("phar")) die("skip"); ?>
 --INI--
-phar.readonly=1
+phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar->setStub("<?php __HALT_COMPILER(); ?>");
 
 $files = array();
+
 $files['a.php'] = '<?php echo "This is a\n"; ?>';
 $files['b.php'] = '<?php echo "This is b\n"; ?>';
 $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
 
-$fp = fopen($pname . '/b/new.php', 'wb');
+$phar->stopBuffering();
+ini_set('phar.readonly', 1);
+
+$fp = fopen($alias . '/b/new.php', 'wb');
 fwrite($fp, 'extra');
 fclose($fp);
-include $pname . '/b/c.php';
-include $pname . '/b/new.php';
+include $alias . '/b/c.php';
+include $alias . '/b/new.php';
+
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 
-Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d
 
 Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d
 
 Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d
 This is b/c
 
-Warning: include(phar://%sopen_for_write_newfile_c.phar.tar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar.php" in %sopen_for_write_newfile_c.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar" in %sopen_for_write_newfile_c.php on line %d
 
-Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.tar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d
+Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.tar/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d
 
 ===DONE===
\ No newline at end of file
index db6a22391ddbb09a3a4229fd2b706318b2955053..1102df7c19e50d5e74baf606349a0d91d0408105 100644 (file)
@@ -7,33 +7,35 @@ phar.require_hash=0
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', '<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+
+$phar = new Phar($fname);
+$phar->setStub('<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
+$phar->setAlias('hio');
 
 $files = array();
+
 $files['a'] = 'a';
 $files['b'] = 'b';
 $files['c'] = 'c';
-$files['.phar/alias.txt'] = 'hio';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
 
-$phar = new Phar($fname);
+$phar->stopBuffering();
+
 echo $phar->getAlias() . "\n";
 $phar->setAlias('test');
 echo $phar->getAlias() . "\n";
+
 ?>
 ===DONE===
 --CLEAN--
 <?php 
-unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
-unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.php');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.tar');
 __HALT_COMPILER();
 ?>
 --EXPECT--
index 63be3b5d07496e1441efa22b00c225efc8b02a03..d48c041b76110b4549bdfc600a4ffd0299b163a8 100644 (file)
@@ -7,44 +7,47 @@ phar.require_hash=0
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', '<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+
+$phar = new Phar($fname);
+$phar->setStub('<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
+$phar->setAlias('hio');
 
 $files = array();
+
 $files['a'] = 'a';
 $files['b'] = 'b';
 $files['c'] = 'c';
-$files['.phar/alias.txt'] = 'hio';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $phar[$n] = $file;
 }
-$a->close();
 
-$phar = new Phar($fname);
+$phar->stopBuffering();
+
 echo $phar->getAlias() . "\n";
 $phar->setAlias('test');
 echo $phar->getAlias() . "\n";
+
 $phar = new Phar(dirname(__FILE__) . '/notphar.phar');
+
 try {
        $phar->setAlias('test');
 } catch (Exception $e) {
        echo $e->getMessage() . "\n";
 }
+
 ?>
 ===DONE===
 --CLEAN--
 <?php 
-unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
-unlink(dirname(__FILE__) . '/notphar.phar');
-unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.php');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.tar');
 __HALT_COMPILER();
 ?>
 --EXPECTF--
 hio
 test
-alias "test" is already used for archive "%sphar_setalias2.phar.php" and cannot be used for other archives
+alias "test" is already used for archive "%sphar_setalias2.phar.tar" and cannot be used for other archives
 ===DONE===
index 0c4de9657a3cfa369c1ecda4f4e5f49bb3a14791..5d35b932fe6e915c39a5234a44274394b68054a5 100755 (executable)
@@ -7,35 +7,27 @@ phar.require_hash=0
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', $stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
 
-$files = array();
-$files['a'] = 'a';
-$files['.phar/alias.txt'] = 'hio';
-foreach ($files as $n => $file) {
-$a->addFile($n, $file);
-}
-$a->close();
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
 
 $phar = new Phar($fname);
+$phar->setStub($stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>' ."\r\n");
+$phar->setAlias('hio');
+$phar['a'] = 'a';
+$phar->stopBuffering();
+
 var_dump($stub);
 var_dump($phar->getStub());
 var_dump($phar->getStub() == $stub);
 
 $newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>';
-try
-{
+
+try {
        $phar->setStub($newstub);
-}
-catch(exception $e)
-{
+} catch(exception $e) {
        echo 'Exception: ' . $e->getMessage() . "\n";
 }
+
 var_dump($phar->getStub());
 var_dump($phar->getStub() == $stub);
 $phar->stopBuffering();
@@ -46,16 +38,20 @@ var_dump($phar->getStub() == $stub);
 ===DONE===
 --CLEAN--
 <?php 
-unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
 __HALT_COMPILER();
 ?>
 --EXPECTF--
-string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
-string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
+string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>
+"
+string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>
+"
 bool(true)
-Exception: illegal stub for tar-based phar "%sphar_stub_error.phar.php"
-string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
+Exception: illegal stub for tar-based phar "%sphar_stub_error.phar.tar"
+string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>
+"
 bool(true)
-string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
+string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>
+"
 bool(true)
 ===DONE===
index add9ebfdab1f519f2854b1a96cc71ff685fe9612..c6808afb63b8b498b98e3c5a321ba4a3c107bac7 100644 (file)
@@ -9,61 +9,65 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
+include dirname(__FILE__) . '/files/tarmaker.php.inc';
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
 
+$tar = new tarmaker($fname, 'none');
+$tar->init();
+$tar->addFile('.phar/stub.php', "<?php __HALT_COMPILER(); ?>");
 
 $files = array();
+
 $files['a.php'] = '<?php echo "This is a\n"; ?>';
 $files['b.php'] = '<?php echo "This is b\n"; ?>';
 $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
 $files['.phar/alias.txt'] = 'hio';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $tar->addFile($n, $file);
 }
-$a->close();
 
-$fp = fopen($pname . '/b/c.php', 'wb');
+$tar->close();
+
+$fp = fopen($alias . '/b/c.php', 'wb');
 fwrite($fp, "extra");
 fclose($fp);
 echo "===CLOSE===\n";
-$p = new Phar($fname);
-$b = fopen($pname . '/b/c.php', 'rb');
-$a = $p['b/c.php'];
+$phar = new Phar($fname);
+$b = fopen($alias . '/b/c.php', 'rb');
+$a = $phar['b/c.php'];
 var_dump($a);
 var_dump(fread($b, 20));
 rewind($b);
 echo "===UNLINK===\n";
-unlink($pname . '/b/c.php');
+unlink($alias . '/b/c.php');
 var_dump($a);
 var_dump(fread($b, 20));
-include $pname . '/b/c.php';
+include $alias . '/b/c.php';
+
 ?>
 
 ===DONE===
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 ===CLOSE===
 object(PharFileInfo)#%d (2) {
   ["pathName":"SplFileInfo":private]=>
-  string(%d) "phar://%srefcount1.phar.php/b"
+  string(%d) "phar://%srefcount1.phar.tar/b"
   ["fileName":"SplFileInfo":private]=>
-  string(%d) "phar://%srefcount1.phar.php/b/c.php"
+  string(%d) "phar://%srefcount1.phar.tar/b/c.php"
 }
 string(5) "extra"
 ===UNLINK===
 
-Warning: unlink(): phar error: "b/c.php" in phar "%srefcount1.phar.php", has open file pointers, cannot unlink in %srefcount1.php on line %d
+Warning: unlink(): phar error: "b/c.php" in phar "%srefcount1.phar.tar", has open file pointers, cannot unlink in %srefcount1.php on line %d
 object(PharFileInfo)#%d (2) {
   ["pathName":"SplFileInfo":private]=>
-  string(%d) "phar://%srefcount1.phar.php/b"
+  string(%d) "phar://%srefcount1.phar.tar/b"
   ["fileName":"SplFileInfo":private]=>
-  string(%s) "phar://%srefcount1.phar.php/b/c.php"
+  string(%s) "phar://%srefcount1.phar.tar/b/c.php"
 }
 string(5) "extra"
 extra
index e3e3dfa984bbee0b6f08dc7cac12aaa5f55efae2..96588a659673f3f62c0ed61ba883c1c2da1ff6de 100644 (file)
@@ -7,33 +7,36 @@ phar.readonly=0
 phar.require_hash=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://' . $fname;
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('.phar/stub.php', "<?php
+include dirname(__FILE__) . '/files/tarmaker.php.inc';
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
+$alias = 'phar://' . $fname;
+
+$tar = new tarmaker($fname, 'none');
+$tar->init();
+$tar->addFile('.phar/stub.php', "<?php
 Phar::mapPhar('hio');
 __HALT_COMPILER(); ?>");
 
 $files = array();
 $files['a'] = 'a';
+
 foreach ($files as $n => $file) {
-$a->addFile($n, $file);
+       $tar->addFile($n, $file);
 }
-$a->close();
+
+$tar->close();
 
 include $fname;
 
-echo file_get_contents($pname . '/a') . "\n";
-rename($pname . '/a', $pname . '/b');
-echo file_get_contents($pname . '/b') . "\n";
-echo file_get_contents($pname . '/a') . "\n";
+echo file_get_contents($alias . '/a') . "\n";
+rename($alias . '/a', $alias . '/b');
+echo file_get_contents($alias . '/b') . "\n";
+echo file_get_contents($alias . '/a') . "\n";
 ?>
 --CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
 --EXPECTF--
 a
 a
 
-Warning: file_get_contents(phar://%srename.phar.php/a): failed to open stream: phar error: "a" is not a file in phar "%srename.phar.php" in %srename.php on line %d
\ No newline at end of file
+Warning: file_get_contents(phar://%srename.phar.tar/a): failed to open stream: phar error: "a" is not a file in phar "%srename.phar.tar" in %srename.php on line %d
index c0e7ea308cca58c4e252f8e1472c0da3dfe1ec9a..76242c89fb62fce9b3980389096cffb8181433c7 100644 (file)
@@ -5,18 +5,19 @@ Phar: tar-based phar corrupted
 <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
 --FILE--
 <?php
-include dirname(__FILE__) . '/make_invalid_tar.php.inc';
-$a = new corrupter(dirname(__FILE__) . '/tar_001.phar', 'none');
-$a->init();
-$a->addFile('tar_001.phpt', __FILE__);
-$a->close();
+include dirname(__FILE__) . '/files/make_invalid_tar.php.inc';
 
-$a = fopen('phar://' . dirname(__FILE__) . '/tar_001.phar/tar_001.phpt', 'rb');
+$tar = new corrupter(dirname(__FILE__) . '/tar_001.phar.tar', 'none');
+$tar->init();
+$tar->addFile('tar_001.phpt', __FILE__);
+$tar->close();
+
+$tar = fopen('phar://' . dirname(__FILE__) . '/tar_001.phar.tar/tar_001.phpt', 'rb');
 try {
-$a = new Phar(dirname(__FILE__) . '/tar_001.phar');
-echo "should not execute\n";
+       $phar = new Phar(dirname(__FILE__) . '/tar_001.phar.tar');
+       echo "should not execute\n";
 } catch (Exception $e) {
-echo $e->getMessage() . "\n";
+       echo $e->getMessage() . "\n";
 }
 ?>
 ===DONE===
@@ -25,6 +26,6 @@ echo $e->getMessage() . "\n";
 @unlink(dirname(__FILE__) . '/tar_001.phar');
 ?>
 --EXPECTF--
-Warning: fopen(phar://%star_001.phar/tar_001.phpt): failed to open stream: phar error: "%star_001.phar" is a corrupted tar file in %star_001.php on line %d
-Cannot open phar file '%star_001.phar' with alias '(null)': phar error: "%star_001.phar" is a corrupted tar file
+Warning: fopen(phar://%star_001.phar.tar/tar_001.phpt): failed to open stream: phar error: "%star_001.phar.tar" is a corrupted tar file in %star_001.php on line %d
+Cannot open phar file '%star_001.phar.tar' with alias '(null)': phar error: "%star_001.phar.tar" is a corrupted tar file
 ===DONE===
\ No newline at end of file
index b9e4c59392cf26ab6411c518fac82c4c0dedd4c9..2674e416b84a5fd4fc17f775848e0dd23d591a0a 100644 (file)
@@ -7,26 +7,28 @@ Phar: tar-based phar corrupted 2
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/make_invalid_tar.php.inc';
-$a = new corrupter(dirname(__FILE__) . '/tar_002.phar', 'none');
-$a->init();
-$a->addFile('tar_002.phpt', __FILE__);
-$a->close();
+include dirname(__FILE__) . '/files/make_invalid_tar.php.inc';
+
+$tar = new corrupter(dirname(__FILE__) . '/tar_002.phar.tar', 'none');
+$tar->init();
+$tar->addFile('tar_002.phpt', __FILE__);
+$tar->close();
+
+$tar = fopen('phar://' . dirname(__FILE__) . '/tar_002.phar.tar/tar_002.phpt', 'rb');
 
-$a = fopen('phar://' . dirname(__FILE__) . '/tar_002.phar/tar_002.phpt', 'rb');
 try {
-$a = new Phar(dirname(__FILE__) . '/tar_002.phar');
-echo "should not execute\n";
+       $phar = new Phar(dirname(__FILE__) . '/tar_002.phar.tar');
+       echo "should not execute\n";
 } catch (Exception $e) {
-echo $e->getMessage() . "\n";
+       echo $e->getMessage() . "\n";
 }
 ?>
 ===DONE===
 --CLEAN--
 <?php
-@unlink(dirname(__FILE__) . '/tar_002.phar');
+@unlink(dirname(__FILE__) . '/tar_002.phar.tar');
 ?>
 --EXPECTF--
-Warning: fopen(phar://%star_002.phar/tar_002.phpt): failed to open stream: phar error: "%star_002.phar" is a corrupted tar file in %star_002.php on line %d
-Cannot open phar file '%star_002.phar' with alias '(null)': phar error: "%star_002.phar" is a corrupted tar file
+Warning: fopen(phar://%star_002.phar.tar/tar_002.phpt): failed to open stream: phar error: "%star_002.phar.tar" is a corrupted tar file in %star_002.php on line %d
+Cannot open phar file '%star_002.phar.tar' with alias '(null)': phar error: "%star_002.phar.tar" is a corrupted tar file
 ===DONE===
\ No newline at end of file
index b8e5f41d82d5e785f63f3f7232eeab22488b29d2..e7beecb55ca1c2c63c47715a2d47da3299873e0d 100644 (file)
@@ -7,41 +7,45 @@ Phar: tar-based phar, valid 1
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/tar_003.phar';
-$pname = 'phar://' . $fname;
-
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('tar_003.phpt', $g = fopen(__FILE__, 'r'));
-$a->addFile('internal/file/here', "hi there!\n");
-$a->mkDir('internal/dir');
-$a->mkDir('dir');
-$a->close();
+include dirname(__FILE__) . '/files/tarmaker.php.inc';
+
+$fname = dirname(__FILE__) . '/tar_003.phar.tar';
+$alias = 'phar://' . $fname;
+
+$tar = new tarmaker($fname, 'none');
+$tar->init();
+$tar->addFile('tar_003.phpt', $g = fopen(__FILE__, 'r'));
+$tar->addFile('internal/file/here', "hi there!\n");
+$tar->mkDir('internal/dir');
+$tar->mkDir('dir');
+$tar->close();
+
 fclose($g);
 
-echo file_get_contents($pname . '/internal/file/here');
-$a = opendir($pname . '/');
-while (false !== ($v = readdir($a))) {
-       echo (is_file($pname . '/' . $v) ? "file\n" : "dir\n");
+echo file_get_contents($alias . '/internal/file/here');
+
+$tar = opendir($alias . '/');
+
+while (false !== ($v = readdir($tar))) {
+       echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n");
        echo $v . "\n";
 }
-closedir($a);
+closedir($tar);
 
 /* ensure none of the dir tar files were freed */
 echo "second round\n";
-$a = opendir($pname . '/');
-while (false !== ($v = readdir($a))) {
-       echo (is_file($pname . '/' . $v) ? "file\n" : "dir\n");
+$tar = opendir($alias . '/');
+while (false !== ($v = readdir($tar))) {
+       echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n");
        echo $v . "\n";
 }
-closedir($a);
+closedir($tar);
 
 ?>
 ===DONE===
 --CLEAN--
 <?php
-@unlink(dirname(__FILE__) . '/tar_003.phar');
+@unlink(dirname(__FILE__) . '/tar_003.phar.tar');
 ?>
 --EXPECT--
 hi there!
index 63a3dd8b91c34b123aba561545362de694eb35c6..2dd7ba169f74ab7b5d87b9cf7ede67397ee343ca 100644 (file)
@@ -7,31 +7,32 @@ Phar: tar-based phar, tar phar with stub, mapPhar()
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/tar_004.phar';
-$pname = 'phar://' . $fname;
+include dirname(__FILE__) . '/files/tarmaker.php.inc';
 
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('tar_004.php', '<?php var_dump(__FILE__);');
-$a->addFile('internal/file/here', "hi there!\n");
-$a->mkDir('internal/dir');
-$a->mkDir('dir');
-$a->addFile('.phar/stub.php', '<?php
+$fname = dirname(__FILE__) . '/tar_004.phar.tar';
+$alias = 'phar://' . $fname;
+
+$tar = new tarmaker($fname, 'none');
+$tar->init();
+$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
+$tar->addFile('internal/file/here', "hi there!\n");
+$tar->mkDir('internal/dir');
+$tar->mkDir('dir');
+$tar->addFile('.phar/stub.php', '<?php
 Phar::mapPhar();
 var_dump("it worked");
 include "phar://" . __FILE__ . "/tar_004.php";
 ');
-$a->close();
+$tar->close();
 
 include $fname;
 ?>
 ===DONE===
 --CLEAN--
 <?php
-@unlink(dirname(__FILE__) . '/tar_004.phar');
+@unlink(dirname(__FILE__) . '/tar_004.phar.tar');
 ?>
 --EXPECTF--
 string(9) "it worked"
-string(%d) "phar://%star_004.phar/tar_004.php"
+string(%d) "phar://%star_004.phar.tar/tar_004.php"
 ===DONE===
\ No newline at end of file
index 65f062261ff2235b85dc2eb7a21c3426c2415bd6..8c34fbc98a44430059757f287f04fbbff34e69b0 100644 (file)
@@ -8,33 +8,37 @@ Phar: tar-based phar, bzipped tar
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
+include dirname(__FILE__) . '/files/tarmaker.php.inc';
+
 $fname = dirname(__FILE__) . '/tar_bz2.phar';
-$pname = 'phar://' . $fname;
+$alias = 'phar://' . $fname;
 $fname2 = dirname(__FILE__) . '/tar_bz2.phar.tar';
-$pname2 = 'phar://' . $fname2;
+$alias2 = 'phar://' . $fname2;
 
-$a = new tarmaker($fname, 'bz2');
-$a->init();
-$a->addFile('tar_004.php', '<?php var_dump(__FILE__);');
-$a->addFile('internal/file/here', "hi there!\n");
-$a->mkDir('internal/dir');
-$a->mkDir('dir');
-$a->addFile('.phar/stub.php', '<?php
+$tar = new tarmaker($fname, 'bz2');
+$tar->init();
+$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
+$tar->addFile('internal/file/here', "hi there!\n");
+$tar->mkDir('internal/dir');
+$tar->mkDir('dir');
+$tar->addFile('.phar/stub.php', '<?php
 Phar::mapPhar();
 var_dump("it worked");
 include "phar://" . __FILE__ . "/tar_004.php";
 ');
-$a->close();
+$tar->close();
 
 include $fname;
 
-$a = new Phar($fname);
-$a['test'] = 'hi';
+$phar = new Phar($fname);
+$phar['test'] = 'hi';
+
 copy($fname, $fname2);
-$b = new Phar($fname2);
-var_dump($b->isTar());
-var_dump($b->isCompressed() == Phar::BZ2);
+
+$phar2 = new Phar($fname2);
+var_dump($phar2->isTar());
+var_dump($phar2->isCompressed() == Phar::BZ2);
+
 ?>
 ===DONE===
 --CLEAN--
index 9fccc79226eb5b0d45bb2318d29b26848577312a..a7fcb7c228e87d45f7d509f305c43b85da57c9f6 100644 (file)
@@ -9,7 +9,7 @@ Phar: tar-based phar, gzipped tar
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
+include dirname(__FILE__) . '/files/tarmaker.php.inc';
 $fname = dirname(__FILE__) . '/tar_gzip.phar';
 $pname = 'phar://' . $fname;
 $fname2 = dirname(__FILE__) . '/tar_gzip.phar.tar';
index 3dd27352778e3c29f70103cff1e547a68c5d7581..203265b385ae9cf63a802c75ef4c0f7d74f482bf 100644 (file)
@@ -8,26 +8,29 @@ Phar: tar-based phar, make new bzipped tar
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
+
 $fname = dirname(__FILE__) . '/tar_makebz2.phar.tar';
-$pname = 'phar://' . $fname;
-$fname2 = dirname(__FILE__) . '/tar_makebz22.phar.tar';
-$pname2 = 'phar://' . $fname2;
+$alias = 'phar://' . $fname;
+$fname2 = dirname(__FILE__) . '/tar_makebz2_b.phar.tar';
+$alias2 = 'phar://' . $fname2;
+
+$phar = new Phar($fname);
+$phar['test'] = 'hi';
+var_dump($phar->isTar());
+$phar->compressAllFilesBZIP2();
 
-$a = new Phar($fname);
-$a['test'] = 'hi';
-var_dump($a->isTar());
-$a->compressAllFilesBZIP2();
 copy($fname, $fname2);
-$b = new Phar($fname2);
-var_dump($b->isTar());
-var_dump($b->isCompressed() == Phar::BZ2);
+
+$phar2 = new Phar($fname2);
+var_dump($phar2->isTar());
+var_dump($phar2->isCompressed() == Phar::BZ2);
+
 ?>
 ===DONE===
 --CLEAN--
 <?php
 @unlink(dirname(__FILE__) . '/tar_makebz2.phar.tar');
-@unlink(dirname(__FILE__) . '/tar_makebz22.phar.tar');
+@unlink(dirname(__FILE__) . '/tar_makebz2_b.phar.tar');
 ?>
 --EXPECTF--
 bool(true)
index bf5c065d8376ede4df06c6f9e767b0a2d0c245ec..280c51a762e5ec64131f06c0bd73ff6a514c3d2d 100644 (file)
@@ -8,26 +8,29 @@ Phar: tar-based phar, make new gzipped tar
 phar.readonly=0
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
+
 $fname = dirname(__FILE__) . '/tar_makegz.phar.tar';
-$pname = 'phar://' . $fname;
-$fname2 = dirname(__FILE__) . '/tar_makegz2.phar.tar';
-$pname2 = 'phar://' . $fname2;
+$alias = 'phar://' . $fname;
+$fname2 = dirname(__FILE__) . '/tar_makegz_b.phar.tar';
+$alias2 = 'phar://' . $fname2;
+
+$phar = new Phar($fname);
+$phar['test'] = 'hi';
+var_dump($phar->isTar());
+$phar->compressAllFilesGZ();
 
-$a = new Phar($fname);
-$a['test'] = 'hi';
-var_dump($a->isTar());
-$a->compressAllFilesGZ();
 copy($fname, $fname2);
-$b = new Phar($fname2);
-var_dump($b->isTar());
-var_dump($b->isCompressed() == Phar::GZ);
+
+$phar2 = new Phar($fname2);
+var_dump($phar2->isTar());
+var_dump($phar2->isCompressed() == Phar::GZ);
+
 ?>
 ===DONE===
 --CLEAN--
 <?php
 @unlink(dirname(__FILE__) . '/tar_makegz.phar.tar');
-@unlink(dirname(__FILE__) . '/tar_makegz2.phar.tar');
+@unlink(dirname(__FILE__) . '/tar_makegz_b.phar.tar');
 ?>
 --EXPECTF--
 bool(true)
index 9b330251b4daa0410199f994d4bad39311a09ffe..fa4b96ebf140185622be4bb46ecba604915f0e8f 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-Phar: tar-based phar, externally created tar with no stub, Phar->getStub()
+Phar: tar-based phar, third-party tar with no stub, Phar->getStub()
 --SKIPIF--
 <?php if (!extension_loaded('phar')) die('skip'); ?>
 <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
@@ -7,18 +7,19 @@ Phar: tar-based phar, externally created tar with no stub, Phar->getStub()
 phar.readonly=1
 --FILE--
 <?php
-include dirname(__FILE__) . '/tarmaker.php.inc';
-$fname = dirname(__FILE__) . '/tar_004.phar';
-$pname = 'phar://' . $fname;
+include dirname(__FILE__) . '/files/tarmaker.php.inc';
+$fname = dirname(__FILE__) . '/tar_004.phar.tar';
+$alias = 'phar://' . $fname;
 
-$a = new tarmaker($fname, 'none');
-$a->init();
-$a->addFile('tar_004.php', '<?php var_dump(__FILE__);');
-$a->addFile('internal/file/here', "hi there!\n");
-$a->close();
+$tar = new tarmaker($fname, 'none');
+$tar->init();
+$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
+$tar->addFile('internal/file/here', "hi there!\n");
+$tar->close();
+
+$phar = new Phar($fname);
+var_dump($phar->getStub());
 
-$b = new Phar($fname);
-var_dump($b->getStub());
 ?>
 ===DONE===
 --CLEAN--
@@ -27,4 +28,4 @@ var_dump($b->getStub());
 ?>
 --EXPECTF--
 string(0) ""
-===DONE===
\ No newline at end of file
+===DONE===
diff --git a/ext/phar/tests/tar/tarmaker.php.inc b/ext/phar/tests/tar/tarmaker.php.inc
deleted file mode 100644 (file)
index 9025078..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-// stolen from PEAR2_Pyrus_Developer_Creator_Tar by Greg Beaver, the original author, for use in unit tests
-class tarmaker
-{
-    /**
-     * Path to archive file
-     *
-     * @var string
-     */
-    protected $archive;
-    /**
-     * Temporary stream used for creating the archive
-     *
-     * @var stream
-     */
-    protected $tmp;
-    protected $path;
-    protected $compress;
-    function __construct($path, $compress = 'zlib')
-    {
-        $this->compress = $compress;
-        if ($compress === 'bz2' && !function_exists('bzopen')) {
-            throw new PEAR2_Pyrus_Developer_Creator_Exception(
-                'bzip2 extension not available');
-        }
-        if ($compress === 'zlib' && !function_exists('gzopen')) {
-            throw new PEAR2_Pyrus_Developer_Creator_Exception(
-                'zlib extension not available');
-        }
-        $this->path = $path;
-    }
-
-    /**
-     * save a file inside this package
-     * 
-     * This code is modified from Vincent Lascaux's File_Archive
-     * package, which is licensed under the LGPL license.
-     * @param string relative path within the package
-     * @param string|resource file contents or open file handle
-     */
-    function addFile($path, $fileOrStream, $stat = null)
-    {
-        clearstatcache();
-        if ($stat === null) {
-            if (is_resource($fileOrStream)) {
-                $stat = fstat($fileOrStream);
-            } else {
-                $stat = array(
-                    'mode' => 0x8000 + 0644,
-                    'uid' => 0,
-                    'gid' => 0,
-                    'size' => strlen($fileOrStream),
-                    'mtime' => time(),
-                );
-            }
-        }
-
-        $link = null;
-        if ($stat['mode'] & 0x4000) {
-            $type = 5;        // Directory
-        } else if ($stat['mode'] & 0x8000) {
-            $type = 0;        // Regular
-        } else if ($stat['mode'] & 0xA000) {
-            $type = 1;        // Link
-            $link = @readlink($current);
-        } else {
-            $type = 9;        // Unknown
-        }
-
-        $filePrefix = '';
-        if (strlen($path) > 255) {
-            throw new Exception(
-                "$path is too long, must be 255 characters or less"
-            );
-        } else if (strlen($path) > 100) {
-            $filePrefix = substr($path, 0, strlen($path)-100);
-            $path = substr($path, -100);
-        }
-
-        $block = pack('a100a8a8a8a12A12',
-                $path,
-                decoct($stat['mode']),
-                sprintf('%6s ',decoct($stat['uid'])),
-                sprintf('%6s ',decoct($stat['gid'])),
-                sprintf('%11s ',decoct($stat['size'])),
-                sprintf('%11s ',decoct($stat['mtime']))
-            );
-
-        $blockend = pack('a1a100a6a2a32a32a8a8a155a12',
-            $type,
-            $link,
-            'ustar',
-            '00',
-            'Pyrus',
-            'Pyrus',
-            '',
-            '',
-            $filePrefix,
-            '');
-
-        $checkheader = array_merge(str_split($block), str_split($blockend));
-        if (!function_exists('_pear2tarchecksum')) {
-            function _pear2tarchecksum($a, $b) {return $a + ord($b);}
-        }
-        $checksum = 256; // 8 * ord(' ');
-        $checksum += array_reduce($checkheader, '_pear2tarchecksum');
-
-        $checksum = pack('a8', sprintf('%6s ', decoct($checksum)));
-
-        fwrite($this->tmp, $block . $checksum . $blockend, 512);
-        if (is_resource($fileOrStream)) {
-            stream_copy_to_stream($fileOrStream, $this->tmp);
-            if ($stat['size'] % 512) {
-                fwrite($this->tmp, str_repeat("\0", 512 - $stat['size'] % 512));
-            }
-        } else {
-            fwrite($this->tmp, $fileOrStream);
-            if (strlen($fileOrStream) % 512) {
-                fwrite($this->tmp, str_repeat("\0", 512 - strlen($fileOrStream) % 512));
-            }
-        }
-    }
-
-    /**
-     * Initialize the package creator
-     */
-    function init()
-    {
-        switch ($this->compress) {
-            case 'zlib' :
-                $this->tmp = gzopen($this->path, 'wb');
-                break;
-            case 'bz2' :
-                $this->tmp = bzopen($this->path, 'w');
-                break;
-            case 'none' :
-                $this->tmp = fopen($this->path, 'wb');
-                break;
-            default :
-                throw new Exception(
-                    'unknown compression type ' . $this->compress);
-        }
-    }
-
-    /**
-     * Create an internal directory, creating parent directories as needed
-     * 
-     * @param string $dir
-     */
-    function mkdir($dir)
-    {
-        $this->addFile($dir, "", array(
-                    'mode' => 0x4000 + 0644,
-                    'uid' => 0,
-                    'gid' => 0,
-                    'size' => 0,
-                    'mtime' => time(),
-                ));
-    }
-
-    /**
-     * Finish saving the package
-     */
-    function close()
-    {
-        fwrite($this->tmp, pack('a1024', ''));
-        fclose($this->tmp);
-    }
-}
\ No newline at end of file