summaryrefslogtreecommitdiff
path: root/ext/phar/tests
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
committerOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
commit0fab6db7cac8d2be99579dd049f812a8ff98e74f (patch)
tree91f01b0d06916c78262404096bfd466b8e95e5b5 /ext/phar/tests
parentd3a8757891280dc6650ca7eead67830c794b0e7b (diff)
downloadphp-0fab6db7cac8d2be99579dd049f812a8ff98e74f.tar.gz
Imported Upstream version 5.3.1upstream/5.3.1
Diffstat (limited to 'ext/phar/tests')
-rw-r--r--ext/phar/tests/009.phpt2
-rw-r--r--ext/phar/tests/016.phpt6
-rw-r--r--ext/phar/tests/badparameters.phpt6
-rw-r--r--ext/phar/tests/bug46032.phpt8
-rw-r--r--ext/phar/tests/bug48377.2.phpt25
-rw-r--r--ext/phar/tests/bug48377.phpt29
-rw-r--r--ext/phar/tests/cache_list/copyonwrite17.phar.phpt2
-rw-r--r--ext/phar/tests/cache_list/copyonwrite19.phar.phpt2
-rw-r--r--ext/phar/tests/cache_list/copyonwrite6.phar.phpt1
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller12.pharbin581 -> 588 bytes
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller12.phar.inc14
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller14.pharbin448 -> 450 bytes
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller14.phar.inc4
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller3.pharbin446 -> 437 bytes
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller3.phar.inc2
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller4.pharbin442 -> 433 bytes
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller4.phar.inc2
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller8.pharbin8968 -> 8970 bytes
-rw-r--r--ext/phar/tests/cache_list/files/frontcontroller8.phar.inc2
-rw-r--r--ext/phar/tests/cache_list/files/write24.pharbin326 -> 327 bytes
-rw-r--r--ext/phar/tests/cache_list/files/write24.phar.inc2
-rw-r--r--ext/phar/tests/cache_list/frontcontroller21.phpt2
-rw-r--r--ext/phar/tests/cache_list/frontcontroller22.phpt4
-rwxr-xr-xext/phar/tests/create_new_and_modify.phpt6
-rw-r--r--ext/phar/tests/files/frontcontroller12.pharbin581 -> 588 bytes
-rw-r--r--ext/phar/tests/files/frontcontroller12.phar.inc14
-rw-r--r--ext/phar/tests/files/frontcontroller14.pharbin448 -> 450 bytes
-rw-r--r--ext/phar/tests/files/frontcontroller14.phar.inc4
-rw-r--r--ext/phar/tests/files/frontcontroller3.pharbin446 -> 438 bytes
-rw-r--r--ext/phar/tests/files/frontcontroller3.phar.inc2
-rw-r--r--ext/phar/tests/files/frontcontroller4.pharbin442 -> 433 bytes
-rw-r--r--ext/phar/tests/files/frontcontroller4.phar.inc2
-rw-r--r--ext/phar/tests/files/frontcontroller8.pharbin8968 -> 8970 bytes
-rw-r--r--ext/phar/tests/files/frontcontroller8.phar.inc2
-rw-r--r--ext/phar/tests/fopen_edgecases2.phpt7
-rw-r--r--ext/phar/tests/fopen_edgecases2U.phpt46
-rw-r--r--ext/phar/tests/frontcontroller21.phpt2
-rw-r--r--ext/phar/tests/frontcontroller22.phpt4
-rw-r--r--ext/phar/tests/ini_set.phpt19
-rw-r--r--ext/phar/tests/ini_setU.phpt31
-rw-r--r--ext/phar/tests/phar_buildfromiterator10.phpt1
-rw-r--r--ext/phar/tests/phar_buildfromiterator10U.phpt101
-rw-r--r--ext/phar/tests/phar_bz2.phpt5
-rw-r--r--ext/phar/tests/phar_bz2U.phpt66
-rw-r--r--ext/phar/tests/phar_convert_again.phpt6
-rw-r--r--ext/phar/tests/phar_ctx_001.phpt2
-rw-r--r--ext/phar/tests/phar_magic.phpt3
-rw-r--r--ext/phar/tests/readfile_edgecases.phpt1
-rw-r--r--ext/phar/tests/readfile_edgecasesU.phpt61
-rw-r--r--ext/phar/tests/tar/bignames.phpt28
-rw-r--r--ext/phar/tests/tar/bignames_overflow.phpt8
-rw-r--r--ext/phar/tests/tar/bug49910.phpt50
-rw-r--r--ext/phar/tests/tar/files/P1-1.0.0.tgzbin0 -> 1284 bytes
-rw-r--r--ext/phar/tests/tar/files/P1-1.0.0.tgz.pubkey9
-rw-r--r--ext/phar/tests/tar/files/Structures_Graph-1.0.3.tgzbin0 -> 30191 bytes
-rw-r--r--ext/phar/tests/tar/files/frontcontroller12.phar.inc14
-rw-r--r--ext/phar/tests/tar/files/frontcontroller12.phar.tarbin4096 -> 4096 bytes
-rw-r--r--ext/phar/tests/tar/files/frontcontroller3.phar.inc2
-rw-r--r--ext/phar/tests/tar/files/frontcontroller3.phar.tarbin6144 -> 6144 bytes
-rw-r--r--ext/phar/tests/tar/files/frontcontroller4.phar.inc2
-rw-r--r--ext/phar/tests/tar/files/frontcontroller4.phar.tarbin6144 -> 6144 bytes
-rw-r--r--ext/phar/tests/tar/frontcontroller21.phar.phpt2
-rw-r--r--ext/phar/tests/tar/phar_convert_phar4.phpt2
-rw-r--r--ext/phar/tests/tar/phar_magic.phpt3
-rw-r--r--ext/phar/tests/tar/tar_openssl_hash.phpt22
-rw-r--r--ext/phar/tests/zip/all.phpt1
-rw-r--r--ext/phar/tests/zip/bug48791.phpt15
-rw-r--r--ext/phar/tests/zip/files/corrupt_zipmaker.php.inc2
-rw-r--r--ext/phar/tests/zip/files/frontcontroller12.phar.inc14
-rw-r--r--ext/phar/tests/zip/files/frontcontroller12.phar.zipbin786 -> 793 bytes
-rw-r--r--ext/phar/tests/zip/files/frontcontroller3.phar.inc2
-rw-r--r--ext/phar/tests/zip/files/frontcontroller3.phar.zipbin816 -> 818 bytes
-rw-r--r--ext/phar/tests/zip/files/frontcontroller4.phar.inc2
-rw-r--r--ext/phar/tests/zip/files/frontcontroller4.phar.zipbin812 -> 813 bytes
-rw-r--r--ext/phar/tests/zip/files/test.odtbin0 -> 8303 bytes
-rw-r--r--ext/phar/tests/zip/frontcontroller21.phar.phpt2
-rw-r--r--ext/phar/tests/zip/phar_magic.phpt3
-rw-r--r--ext/phar/tests/zip/phar_setsignaturealgo2.phpt113
78 files changed, 494 insertions, 300 deletions
diff --git a/ext/phar/tests/009.phpt b/ext/phar/tests/009.phpt
index 8b1db2f09..61933b381 100644
--- a/ext/phar/tests/009.phpt
+++ b/ext/phar/tests/009.phpt
@@ -9,7 +9,7 @@ phar.require_hash=0
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
-$file .= pack('VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . str_repeat('A', 500);
+$file .= (binary) pack(b'VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . (binary) str_repeat((binary)'A', 500);
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
diff --git a/ext/phar/tests/016.phpt b/ext/phar/tests/016.phpt
index 302d06d3c..3288e8eca 100644
--- a/ext/phar/tests/016.phpt
+++ b/ext/phar/tests/016.phpt
@@ -9,14 +9,14 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-$file = "<?php __HALT_COMPILER(); ?>";
+$file = b"<?php __HALT_COMPILER(); ?>";
// file length is too short
$files = array();
// "hi" gzdeflated
-$files['a'] = array('cont'=>'a','comp'=> pack('H*', 'cbc80400'),'flags'=>0x00001000, 'ulen' => 1, 'clen' => 4);
+$files['a'] = array('cont'=>b'a','comp'=> (binary)pack('H*', 'cbc80400'),'flags'=>0x00001000, 'ulen' => 1, 'clen' => 4);
$files['b'] = $files['a'];
-$files['c'] = array('cont'=>'*');
+$files['c'] = array('cont'=>b'*');
$files['d'] = $files['a'];
include 'files/phar_test.inc';
diff --git a/ext/phar/tests/badparameters.phpt b/ext/phar/tests/badparameters.phpt
index 2f0e34ecf..d4291e622 100644
--- a/ext/phar/tests/badparameters.phpt
+++ b/ext/phar/tests/badparameters.phpt
@@ -76,11 +76,6 @@ $a->setSignatureAlgorithm(Phar::MD5);
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
-try {
-$c->setSignatureAlgorithm(Phar::MD5);
-} catch (Exception $e) {
-echo $e->getMessage() . "\n";
-}
$a->compress(array());
try {
$a->compress(1);
@@ -160,7 +155,6 @@ A Phar stub cannot be set in a plain tar archive
Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Cannot change stub: phar.readonly=1
Cannot set signature algorithm, phar is read-only
-Cannot set signature algorithm, not possible with zip-based phar archives
Warning: Phar::compress() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
Cannot compress phar archive, phar is read-only
diff --git a/ext/phar/tests/bug46032.phpt b/ext/phar/tests/bug46032.phpt
index 4ff1026b5..5a88d5b42 100644
--- a/ext/phar/tests/bug46032.phpt
+++ b/ext/phar/tests/bug46032.phpt
@@ -6,7 +6,7 @@ Phar: bug #46032: PharData::__construct wrong memory read
--FILE--
<?php
-$a = __DIR__ .'/mytest';
+$a = dirname(__FILE__) .'/mytest';
try {
new phar($a);
@@ -24,11 +24,11 @@ new phardata('0000000000000000000');
?>
===DONE===
--EXPECTF--
-string(%d) "%smytest"
-string(%d) "%smytest"
+%string|unicode%(%d) "%smytest"
+%string|unicode%(%d) "%smytest"
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar '0000000000000000000', file extension (or combination) not recognised' in %sbug46032.php:%d
Stack trace:
-#0 %s(%d): PharData->__construct('000000000000000...')
+#0 %sbug46032.php(%d): PharData->__construct('000000000000000...')
#1 {main}
thrown in %sbug46032.php on line %d
diff --git a/ext/phar/tests/bug48377.2.phpt b/ext/phar/tests/bug48377.2.phpt
new file mode 100644
index 000000000..be2a0e103
--- /dev/null
+++ b/ext/phar/tests/bug48377.2.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Phar: PHP bug #48377 "error message unclear on converting phar with existing file" test #2
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--INI--
+phar.require_hash=0
+phar.readonly=0
+--FILE--
+<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.zip';
+
+$phar = new PharData($fname);
+$phar['x'] = 'hi';
+try {
+ $phar->convertToData(Phar::ZIP, Phar::NONE, '.2.phar.zip');
+} catch (BadMethodCallException $e) {
+ echo $e->getMessage(),"\n";
+}
+?>
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.zip');?>
+--EXPECTF--
+data phar "%sbug48377.2.phar.zip" has invalid extension 2.phar.zip
+===DONE=== \ No newline at end of file
diff --git a/ext/phar/tests/bug48377.phpt b/ext/phar/tests/bug48377.phpt
new file mode 100644
index 000000000..6282a1565
--- /dev/null
+++ b/ext/phar/tests/bug48377.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Phar: PHP bug #48377 "error message unclear on converting phar with existing file"
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--INI--
+phar.require_hash=0
+phar.readonly=0
+--FILE--
+<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
+$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.zip';
+
+touch($fname2);
+
+$phar = new Phar($fname, 0, 'a.phar');
+$phar['x'] = 'hi';
+try {
+ $phar->convertToData(Phar::ZIP, Phar::NONE, 'zip');
+} catch (BadMethodCallException $e) {
+ echo $e->getMessage(),"\n";
+}
+?>
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.zip');?>
+--EXPECTF--
+phar "%sbug48377.zip" exists and must be unlinked prior to conversion
+===DONE=== \ No newline at end of file
diff --git a/ext/phar/tests/cache_list/copyonwrite17.phar.phpt b/ext/phar/tests/cache_list/copyonwrite17.phar.phpt
index 6e1308851..158c049b1 100644
--- a/ext/phar/tests/cache_list/copyonwrite17.phar.phpt
+++ b/ext/phar/tests/cache_list/copyonwrite17.phar.phpt
@@ -10,5 +10,5 @@ phar.readonly=0
files/write17.phar
--EXPECTF--
NULL
-string(2) "hi"
+%string|unicode%(2) "hi"
ok \ No newline at end of file
diff --git a/ext/phar/tests/cache_list/copyonwrite19.phar.phpt b/ext/phar/tests/cache_list/copyonwrite19.phar.phpt
index 4870550c4..6e03554d9 100644
--- a/ext/phar/tests/cache_list/copyonwrite19.phar.phpt
+++ b/ext/phar/tests/cache_list/copyonwrite19.phar.phpt
@@ -10,5 +10,5 @@ phar.readonly=0
files/write19.phar
--EXPECTF--
string(2) "hi"
-string(3) "hi2"
+%string|unicode%(3) "hi2"
ok \ No newline at end of file
diff --git a/ext/phar/tests/cache_list/copyonwrite6.phar.phpt b/ext/phar/tests/cache_list/copyonwrite6.phar.phpt
index 6d6d56187..661fef42c 100644
--- a/ext/phar/tests/cache_list/copyonwrite6.phar.phpt
+++ b/ext/phar/tests/cache_list/copyonwrite6.phar.phpt
@@ -7,6 +7,7 @@ phar.readonly=0
open_basedir=
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip PHP 5.3+ required"); ?>
--FILE_EXTERNAL--
files/write6.phar
--CLEAN--
diff --git a/ext/phar/tests/cache_list/files/frontcontroller12.phar b/ext/phar/tests/cache_list/files/frontcontroller12.phar
index 9e4558761..1cf362928 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller12.phar
+++ b/ext/phar/tests/cache_list/files/frontcontroller12.phar
Binary files differ
diff --git a/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc
index ba17df37e..f1e4645e2 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc
+++ b/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc
@@ -3,13 +3,13 @@
$a = new Phar(dirname(__FILE__) . '/frontcontroller12.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"]);
+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"));
diff --git a/ext/phar/tests/cache_list/files/frontcontroller14.phar b/ext/phar/tests/cache_list/files/frontcontroller14.phar
index 78a42a999..ebc3e9b40 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller14.phar
+++ b/ext/phar/tests/cache_list/files/frontcontroller14.phar
Binary files differ
diff --git a/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc
index d0ebd9a45..23104a642 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc
+++ b/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc
@@ -2,8 +2,8 @@
@unlink(dirname(__FILE__) . '/frontcontroller14.phar');
$a = new Phar(dirname(__FILE__) . '/frontcontroller14.phar');
$a['html/index.php'] = '<?php
-var_dump($_SERVER["PATH_INFO"]);
-var_dump($_SERVER["PATH_TRANSLATED"]);
+var_dump($_SERVER[b"PATH_INFO"]);
+var_dump($_SERVER[b"PATH_TRANSLATED"]);
';
$a->setStub('<?php
function s($a)
diff --git a/ext/phar/tests/cache_list/files/frontcontroller3.phar b/ext/phar/tests/cache_list/files/frontcontroller3.phar
index afcf03af3..35a23eadf 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller3.phar
+++ b/ext/phar/tests/cache_list/files/frontcontroller3.phar
Binary files differ
diff --git a/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc
index 2759d9ee4..6f9126ff4 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc
+++ b/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => "a.phps");
+ static $b = array(b"/hi" => "a.phps");
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/cache_list/files/frontcontroller4.phar b/ext/phar/tests/cache_list/files/frontcontroller4.phar
index 4c9a92a19..835946181 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller4.phar
+++ b/ext/phar/tests/cache_list/files/frontcontroller4.phar
Binary files differ
diff --git a/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc
index 5c6a43f95..daf807e41 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc
+++ b/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => false);
+ static $b = array(b"/hi" => false);
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/cache_list/files/frontcontroller8.phar b/ext/phar/tests/cache_list/files/frontcontroller8.phar
index ec05ceafb..c9c0e409e 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller8.phar
+++ b/ext/phar/tests/cache_list/files/frontcontroller8.phar
Binary files differ
diff --git a/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc
index 1dfb654a0..8629f0890 100644
--- a/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc
+++ b/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc
@@ -2,7 +2,7 @@
@unlink(dirname(__FILE__) . '/frontcontroller8.phar');
$a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar');
$a['a.phps'] = 'hio1';
-$a['a1.phps'] = '<?php var_dump($_SERVER["REQUEST_URI"], $_SERVER["PATH_INFO"]);';
+$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';
diff --git a/ext/phar/tests/cache_list/files/write24.phar b/ext/phar/tests/cache_list/files/write24.phar
index d726ceef7..36972f366 100644
--- a/ext/phar/tests/cache_list/files/write24.phar
+++ b/ext/phar/tests/cache_list/files/write24.phar
Binary files differ
diff --git a/ext/phar/tests/cache_list/files/write24.phar.inc b/ext/phar/tests/cache_list/files/write24.phar.inc
index ac9673196..216f7c46d 100644
--- a/ext/phar/tests/cache_list/files/write24.phar.inc
+++ b/ext/phar/tests/cache_list/files/write24.phar.inc
@@ -8,7 +8,7 @@ $phar->setStub('<?php
$p = new Phar(__FILE__);
var_dump(isset($p["newname"]));
$fp = fopen("phar://" . __FILE__ . "/newname", "w");
-fwrite($fp, "hi");
+fwrite($fp, b"hi");
fclose($fp);
var_dump(isset($p["newname"]));
echo "ok\n";
diff --git a/ext/phar/tests/cache_list/frontcontroller21.phpt b/ext/phar/tests/cache_list/frontcontroller21.phpt
index 9ed315d19..829f2986e 100644
--- a/ext/phar/tests/cache_list/frontcontroller21.phpt
+++ b/ext/phar/tests/cache_list/frontcontroller21.phpt
@@ -15,7 +15,7 @@ files/frontcontroller12.phar
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
-string(10) "/index.php"
+%unicode|string%(10) "/index.php"
string(10) "/index.php"
string(%d) "phar://%sfrontcontroller21.php/index.php"
string(18) "/index.php?test=hi"
diff --git a/ext/phar/tests/cache_list/frontcontroller22.phpt b/ext/phar/tests/cache_list/frontcontroller22.phpt
index 82a8389ad..2769b01f2 100644
--- a/ext/phar/tests/cache_list/frontcontroller22.phpt
+++ b/ext/phar/tests/cache_list/frontcontroller22.phpt
@@ -14,8 +14,8 @@ files/frontcontroller13.phar
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
-string(4) "test"
-string(12) "oof/test.php"
+%string|unicode%(4) "test"
+%string|unicode%(12) "oof/test.php"
Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d
diff --git a/ext/phar/tests/create_new_and_modify.phpt b/ext/phar/tests/create_new_and_modify.phpt
index 66587de02..d6c469d9c 100755
--- a/ext/phar/tests/create_new_and_modify.phpt
+++ b/ext/phar/tests/create_new_and_modify.phpt
@@ -27,9 +27,9 @@ file_put_contents($pname .'/b.php', "another!\n");
$phar = new Phar($fname);
$sig2 = $phar->getSignature();
-var_dump($sig1['hash']);
-var_dump($sig2['hash']);
-var_dump($sig1['hash'] != $sig2['hash']);
+var_dump($sig1[b'hash']);
+var_dump($sig2[b'hash']);
+var_dump($sig1[b'hash'] != $sig2[b'hash']);
include $pname . '/a.php';
include $pname . '/b.php';
diff --git a/ext/phar/tests/files/frontcontroller12.phar b/ext/phar/tests/files/frontcontroller12.phar
index 9e4558761..315c2901e 100644
--- a/ext/phar/tests/files/frontcontroller12.phar
+++ b/ext/phar/tests/files/frontcontroller12.phar
Binary files differ
diff --git a/ext/phar/tests/files/frontcontroller12.phar.inc b/ext/phar/tests/files/frontcontroller12.phar.inc
index ba17df37e..f1e4645e2 100644
--- a/ext/phar/tests/files/frontcontroller12.phar.inc
+++ b/ext/phar/tests/files/frontcontroller12.phar.inc
@@ -3,13 +3,13 @@
$a = new Phar(dirname(__FILE__) . '/frontcontroller12.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"]);
+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"));
diff --git a/ext/phar/tests/files/frontcontroller14.phar b/ext/phar/tests/files/frontcontroller14.phar
index 78a42a999..2bca00665 100644
--- a/ext/phar/tests/files/frontcontroller14.phar
+++ b/ext/phar/tests/files/frontcontroller14.phar
Binary files differ
diff --git a/ext/phar/tests/files/frontcontroller14.phar.inc b/ext/phar/tests/files/frontcontroller14.phar.inc
index d0ebd9a45..23104a642 100644
--- a/ext/phar/tests/files/frontcontroller14.phar.inc
+++ b/ext/phar/tests/files/frontcontroller14.phar.inc
@@ -2,8 +2,8 @@
@unlink(dirname(__FILE__) . '/frontcontroller14.phar');
$a = new Phar(dirname(__FILE__) . '/frontcontroller14.phar');
$a['html/index.php'] = '<?php
-var_dump($_SERVER["PATH_INFO"]);
-var_dump($_SERVER["PATH_TRANSLATED"]);
+var_dump($_SERVER[b"PATH_INFO"]);
+var_dump($_SERVER[b"PATH_TRANSLATED"]);
';
$a->setStub('<?php
function s($a)
diff --git a/ext/phar/tests/files/frontcontroller3.phar b/ext/phar/tests/files/frontcontroller3.phar
index afcf03af3..5c5ff9cae 100644
--- a/ext/phar/tests/files/frontcontroller3.phar
+++ b/ext/phar/tests/files/frontcontroller3.phar
Binary files differ
diff --git a/ext/phar/tests/files/frontcontroller3.phar.inc b/ext/phar/tests/files/frontcontroller3.phar.inc
index 2759d9ee4..c2095947b 100644
--- a/ext/phar/tests/files/frontcontroller3.phar.inc
+++ b/ext/phar/tests/files/frontcontroller3.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => "a.phps");
+ static $b = array(b"/hi" => b"a.phps");
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/files/frontcontroller4.phar b/ext/phar/tests/files/frontcontroller4.phar
index 4c9a92a19..004d1ffd1 100644
--- a/ext/phar/tests/files/frontcontroller4.phar
+++ b/ext/phar/tests/files/frontcontroller4.phar
Binary files differ
diff --git a/ext/phar/tests/files/frontcontroller4.phar.inc b/ext/phar/tests/files/frontcontroller4.phar.inc
index 5c6a43f95..daf807e41 100644
--- a/ext/phar/tests/files/frontcontroller4.phar.inc
+++ b/ext/phar/tests/files/frontcontroller4.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => false);
+ static $b = array(b"/hi" => false);
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/files/frontcontroller8.phar b/ext/phar/tests/files/frontcontroller8.phar
index ec05ceafb..27280a327 100644
--- a/ext/phar/tests/files/frontcontroller8.phar
+++ b/ext/phar/tests/files/frontcontroller8.phar
Binary files differ
diff --git a/ext/phar/tests/files/frontcontroller8.phar.inc b/ext/phar/tests/files/frontcontroller8.phar.inc
index 1dfb654a0..8629f0890 100644
--- a/ext/phar/tests/files/frontcontroller8.phar.inc
+++ b/ext/phar/tests/files/frontcontroller8.phar.inc
@@ -2,7 +2,7 @@
@unlink(dirname(__FILE__) . '/frontcontroller8.phar');
$a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar');
$a['a.phps'] = 'hio1';
-$a['a1.phps'] = '<?php var_dump($_SERVER["REQUEST_URI"], $_SERVER["PATH_INFO"]);';
+$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';
diff --git a/ext/phar/tests/fopen_edgecases2.phpt b/ext/phar/tests/fopen_edgecases2.phpt
index c606024ad..6c5ac7b45 100644
--- a/ext/phar/tests/fopen_edgecases2.phpt
+++ b/ext/phar/tests/fopen_edgecases2.phpt
@@ -2,6 +2,7 @@
Phar: test edge cases of fopen() function interception #2
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (version_compare(php_version(), '6.0', '>=')) die('skip parameter parsing changed in 6.0'); ?>
--INI--
phar.readonly=0
--FILE--
@@ -12,14 +13,14 @@ $pname = 'phar://' . $fname;
fopen(array(), 'r');
chdir(dirname(__FILE__));
-file_put_contents($fname, "blah\n");
-file_put_contents("foob", "test\n");
+file_put_contents($fname, b"blah\n");
+file_put_contents("foob", b"test\n");
$a = fopen($fname, 'rb');
echo fread($a, 1000);
fclose($a);
unlink($fname);
mkdir($pname . '/oops');
-file_put_contents($pname . '/foo/hi', '<?php
+file_put_contents($pname . '/foo/hi', b'<?php
$context = stream_context_create();
$a = fopen("foob", "rb", false, $context);
echo fread($a, 1000);
diff --git a/ext/phar/tests/fopen_edgecases2U.phpt b/ext/phar/tests/fopen_edgecases2U.phpt
new file mode 100644
index 000000000..09c7b0057
--- /dev/null
+++ b/ext/phar/tests/fopen_edgecases2U.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Phar: test edge cases of fopen() function interception #2 (PHP 6)
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (version_compare(PHP_VERSION, "6.0.0-dev", "<")) die("skip Unicode support required"); ?>
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+Phar::interceptFileFuncs();
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
+
+fopen(array(), 'r');
+chdir(dirname(__FILE__));
+file_put_contents($fname, b"blah\n");
+file_put_contents("foob", b"test\n");
+$a = fopen($fname, 'rb');
+echo fread($a, 1000);
+fclose($a);
+unlink($fname);
+mkdir($pname . '/oops');
+file_put_contents($pname . '/foo/hi', b'<?php
+$context = stream_context_create();
+$a = fopen("foob", "rb", false, $context);
+echo fread($a, 1000);
+fclose($a);
+fopen("../oops", "r");
+?>
+');
+include $pname . '/foo/hi';
+?>
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php rmdir(dirname(__FILE__) . '/poo'); ?>
+<?php unlink(dirname(__FILE__) . '/foob'); ?>
+--EXPECTF--
+Notice: Array to string conversion in %sfopen_edgecases2U.php on line 6
+
+Warning: fopen(Array): failed to open stream: No such file or directory in %sfopen_edgecases2U.php on line 6
+blah
+test
+
+Warning: fopen(phar://%sfopen_edgecases2U.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfopen_edgecases2U.phar.php/foo/hi on line 6
+===DONE=== \ No newline at end of file
diff --git a/ext/phar/tests/frontcontroller21.phpt b/ext/phar/tests/frontcontroller21.phpt
index dcdbf575f..bf50c6e80 100644
--- a/ext/phar/tests/frontcontroller21.phpt
+++ b/ext/phar/tests/frontcontroller21.phpt
@@ -14,7 +14,7 @@ files/frontcontroller12.phar
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
-string(10) "/index.php"
+%unicode|string%(10) "/index.php"
string(10) "/index.php"
string(%d) "phar://%sfrontcontroller21.php/index.php"
string(18) "/index.php?test=hi"
diff --git a/ext/phar/tests/frontcontroller22.phpt b/ext/phar/tests/frontcontroller22.phpt
index 827c5688c..b85c1eb49 100644
--- a/ext/phar/tests/frontcontroller22.phpt
+++ b/ext/phar/tests/frontcontroller22.phpt
@@ -13,8 +13,8 @@ files/frontcontroller13.phar
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
-string(4) "test"
-string(12) "oof/test.php"
+%unicode|string%(4) "test"
+%unicode|string%(12) "oof/test.php"
Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d
diff --git a/ext/phar/tests/ini_set.phpt b/ext/phar/tests/ini_set.phpt
index 01dc99589..7ccd6ea12 100644
--- a/ext/phar/tests/ini_set.phpt
+++ b/ext/phar/tests/ini_set.phpt
@@ -3,7 +3,6 @@ Phar: test ini_set with readonly and require_hash enabled
--SKIPIF--
<?php
if (!extension_loaded("phar")) die("skip");
-if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
?>
--INI--
phar.require_hash=1
@@ -14,18 +13,22 @@ var_dump(ini_set('phar.require_hash', 1));
var_dump(ini_set('phar.readonly', 1));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
+if (version_compare(PHP_VERSION, "5.3", "<")) {
+var_dump(false, false);
+} else {
var_dump(ini_set('phar.require_hash', 0));
var_dump(ini_set('phar.readonly', 0));
+}
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
__HALT_COMPILER();
?>
---EXPECT--
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
+--EXPECTF--
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
bool(false)
bool(false)
-string(1) "1"
-string(1) "1"
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
diff --git a/ext/phar/tests/ini_setU.phpt b/ext/phar/tests/ini_setU.phpt
deleted file mode 100644
index 470040f7b..000000000
--- a/ext/phar/tests/ini_setU.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Phar: test ini_set with readonly and require_hash enabled
---SKIPIF--
-<?php
-if (!extension_loaded("phar")) die("skip");
-if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support required");
-?>
---INI--
-phar.require_hash=1
-phar.readonly=1
---FILE--
-<?php
-var_dump(ini_set('phar.require_hash', 1));
-var_dump(ini_set('phar.readonly', 1));
-var_dump(ini_get('phar.require_hash'));
-var_dump(ini_get('phar.readonly'));
-var_dump(ini_set('phar.require_hash', 0));
-var_dump(ini_set('phar.readonly', 0));
-var_dump(ini_get('phar.require_hash'));
-var_dump(ini_get('phar.readonly'));
-__HALT_COMPILER();
-?>
---EXPECT--
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
diff --git a/ext/phar/tests/phar_buildfromiterator10.phpt b/ext/phar/tests/phar_buildfromiterator10.phpt
index 4dc3af7cc..024277ed0 100644
--- a/ext/phar/tests/phar_buildfromiterator10.phpt
+++ b/ext/phar/tests/phar_buildfromiterator10.phpt
@@ -3,7 +3,6 @@ Phar::buildFromIterator() RegexIterator(RecursiveIteratorIterator), SplFileInfo
--SKIPIF--
<?php
if (!extension_loaded("phar")) die("skip");
-if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
?>
--INI--
phar.require_hash=0
diff --git a/ext/phar/tests/phar_buildfromiterator10U.phpt b/ext/phar/tests/phar_buildfromiterator10U.phpt
deleted file mode 100644
index 74f41597a..000000000
--- a/ext/phar/tests/phar_buildfromiterator10U.phpt
+++ /dev/null
@@ -1,101 +0,0 @@
---TEST--
-Phar::buildFromIterator() RegexIterator(RecursiveIteratorIterator), SplFileInfo as current
---SKIPIF--
-<?php
-if (!extension_loaded("phar")) die("skip");
-if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support required");
-?>
---INI--
-phar.require_hash=0
-phar.readonly=0
---FILE--
-<?php
-try {
- chdir(dirname(__FILE__));
- $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar');
- $dir = new RecursiveDirectoryIterator('.');
- $iter = new RecursiveIteratorIterator($dir);
- $a = $phar->buildFromIterator(new RegexIterator($iter, '/_\d{3}\.phpt$/'), dirname(__FILE__) . DIRECTORY_SEPARATOR);
- asort($a);
- var_dump($a);
-} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
-}
-?>
-===DONE===
---CLEAN--
-<?php
-unlink(dirname(__FILE__) . '/buildfromiterator.phar');
-__HALT_COMPILER();
-?>
---EXPECTF--
-array(33) {
- ["phar_ctx_001.phpt"]=>
- unicode(%d) "%sphar_ctx_001.phpt"
- ["phar_get_supported_signatures_001.phpt"]=>
- unicode(%d) "%sphar_get_supported_signatures_001.phpt"
- ["phar_get_supported_signatures_002.phpt"]=>
- unicode(%d) "%sphar_get_supported_signatures_002.phpt"
- ["phar_oo_001.phpt"]=>
- unicode(%d) "%sphar_oo_001.phpt"
- ["phar_oo_002.phpt"]=>
- unicode(%d) "%sphar_oo_002.phpt"
- ["phar_oo_003.phpt"]=>
- unicode(%d) "%sphar_oo_003.phpt"
- ["phar_oo_004.phpt"]=>
- unicode(%d) "%sphar_oo_004.phpt"
- ["phar_oo_005.phpt"]=>
- unicode(%d) "%sphar_oo_005.phpt"
- ["phar_oo_006.phpt"]=>
- unicode(%d) "%sphar_oo_006.phpt"
- ["phar_oo_007.phpt"]=>
- unicode(%d) "%sphar_oo_007.phpt"
- ["phar_oo_008.phpt"]=>
- unicode(%d) "%sphar_oo_008.phpt"
- ["phar_oo_009.phpt"]=>
- unicode(%d) "%sphar_oo_009.phpt"
- ["phar_oo_010.phpt"]=>
- unicode(%d) "%sphar_oo_010.phpt"
- ["phar_oo_011.phpt"]=>
- unicode(%d) "%sphar_oo_011.phpt"
- ["phar_oo_012.phpt"]=>
- unicode(%d) "%sphar_oo_012.phpt"
- ["phar_oo_compressed_001.phpt"]=>
- unicode(%d) "%sphar_oo_compressed_001.phpt"
- ["phar_oo_compressed_002.phpt"]=>
- unicode(%d) "%sphar_oo_compressed_002.phpt"
- ["phpinfo_001.phpt"]=>
- unicode(%d) "%sphpinfo_001.phpt"
- ["phpinfo_002.phpt"]=>
- unicode(%d) "%sphpinfo_002.phpt"
- ["phpinfo_003.phpt"]=>
- unicode(%d) "%sphpinfo_003.phpt"
- ["phpinfo_004.phpt"]=>
- unicode(%d) "%sphpinfo_004.phpt"
- ["tar/tar_001.phpt"]=>
- unicode(%d) "%star%ctar_001.phpt"
- ["tar/tar_002.phpt"]=>
- unicode(%d) "%star%ctar_002.phpt"
- ["tar/tar_003.phpt"]=>
- unicode(%d) "%star%ctar_003.phpt"
- ["tar/tar_004.phpt"]=>
- unicode(%d) "%star%ctar_004.phpt"
- ["zip/corrupt_001.phpt"]=>
- unicode(%d) "%szip%ccorrupt_001.phpt"
- ["zip/corrupt_002.phpt"]=>
- unicode(%d) "%szip%ccorrupt_002.phpt"
- ["zip/corrupt_003.phpt"]=>
- unicode(%d) "%szip%ccorrupt_003.phpt"
- ["zip/corrupt_004.phpt"]=>
- unicode(%d) "%szip%ccorrupt_004.phpt"
- ["zip/corrupt_005.phpt"]=>
- unicode(%d) "%szip%ccorrupt_005.phpt"
- ["zip/corrupt_006.phpt"]=>
- unicode(%d) "%szip%ccorrupt_006.phpt"
- ["zip/corrupt_007.phpt"]=>
- unicode(%d) "%szip%ccorrupt_007.phpt"
- ["zip/corrupt_008.phpt"]=>
- unicode(%d) "%szip%ccorrupt_008.phpt"
-}
-===DONE===
diff --git a/ext/phar/tests/phar_bz2.phpt b/ext/phar/tests/phar_bz2.phpt
index 6e05663d5..0e6e3ecb5 100644
--- a/ext/phar/tests/phar_bz2.phpt
+++ b/ext/phar/tests/phar_bz2.phpt
@@ -3,7 +3,6 @@ Phar: bzipped phar
--SKIPIF--
<?php
if (!extension_loaded("phar")) die("skip");
-if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
if (!extension_loaded("spl")) die("skip SPL not available");
if (!extension_loaded("bz2")) die("skip bz2 not available");
?>
@@ -56,8 +55,8 @@ echo $e->getMessage(),"\n";
@unlink(dirname(__FILE__) . '/phar_bz2.2.phar');
?>
--EXPECTF--
-string(9) "it worked"
-string(%d) "phar://%sphar_bz2.phar/tar_004.php"
+%unicode|string%(9) "it worked"
+%unicode|string%(%d) "phar://%sphar_bz2.phar/tar_004.php"
bool(true)
bool(true)
diff --git a/ext/phar/tests/phar_bz2U.phpt b/ext/phar/tests/phar_bz2U.phpt
deleted file mode 100644
index 62f5c5812..000000000
--- a/ext/phar/tests/phar_bz2U.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-Phar: bzipped phar
---SKIPIF--
-<?php
-if (!extension_loaded("phar")) die("skip");
-if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support required");
-if (!extension_loaded("spl")) die("skip SPL not available");
-if (!extension_loaded("bz2")) die("skip bz2 not available");
-?>
---INI--
-phar.readonly=0
-phar.require_hash=0
---FILE--
-<?php
-$fname = dirname(__FILE__) . '/phar_bz2U.phar';
-$pname = 'phar://' . $fname;
-$fname2 = dirname(__FILE__) . '/phar_bz2U.2.phar';
-$pname2 = 'phar://' . $fname2;
-
-$file = '<?php
-Phar::mapPhar();
-var_dump("it worked");
-include "phar://" . __FILE__ . "/tar_004.php";
-__HALT_COMPILER();';
-
-$files = array();
-$files['tar_004.php'] = '<?php var_dump(__FILE__);';
-$files['internal/file/here'] = "hi there!\n";
-$files['internal/dir/'] = '';
-$files['dir/'] = '';
-$bz2 = true;
-
-include 'files/phar_test.inc';
-
-include $fname;
-
-$a = new Phar($fname);
-$a['test'] = 'hi';
-copy($fname, $fname2);
-$a->setAlias('another');
-$b = new Phar($fname2);
-var_dump($b->isFileFormat(Phar::PHAR));
-var_dump($b->isCompressed() == Phar::BZ2);
-// additional code coverage
-$b->isFileFormat(array());
-try {
-$b->isFileFormat(25);
-} catch (Exception $e) {
-echo $e->getMessage(),"\n";
-}
-?>
-===DONE===
---CLEAN--
-<?php
-@unlink(dirname(__FILE__) . '/phar_bz2U.phar');
-@unlink(dirname(__FILE__) . '/phar_bz2U.2.phar');
-?>
---EXPECTF--
-unicode(9) "it worked"
-unicode(%d) "phar://%sphar_bz2U.phar/tar_004.php"
-bool(true)
-bool(true)
-
-Warning: Phar::isFileFormat() expects parameter 1 to be long, array given in %sphar_bz2U.php on line %d
-Unknown file format specified
-===DONE===
diff --git a/ext/phar/tests/phar_convert_again.phpt b/ext/phar/tests/phar_convert_again.phpt
index 9485f1e6a..bbf2c6633 100644
--- a/ext/phar/tests/phar_convert_again.phpt
+++ b/ext/phar/tests/phar_convert_again.phpt
@@ -62,11 +62,6 @@ $data->setAlias('hi');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
-try {
-$data->setSignatureAlgorithm(Phar::MD5);
-} catch (Exception $e) {
-echo $e->getMessage() . "\n";
-}
$tar = $phar->convertToExecutable(Phar::TAR);
echo $tar->getPath() . "\n";
$data = $tar->convertToData();
@@ -188,7 +183,6 @@ hi
A Phar stub cannot be set in a plain zip archive
A Phar stub cannot be set in a plain zip archive
A Phar alias cannot be set in a plain zip archive
-Cannot set signature algorithm, not possible with zip-based phar archives
%sphar_convert_again2.phar.tar
%sphar_convert_again2.tar
%sphar_convert_again2.phar.tar.gz
diff --git a/ext/phar/tests/phar_ctx_001.phpt b/ext/phar/tests/phar_ctx_001.phpt
index 14b7afc71..72edc5a99 100644
--- a/ext/phar/tests/phar_ctx_001.phpt
+++ b/ext/phar/tests/phar_ctx_001.phpt
@@ -28,7 +28,7 @@ var_dump($phar['b']->isCompressed());
var_dump(file_get_contents($pname . '/c'));
var_dump($phar['c']->isCompressed());
-$context = stream_context_create(array('phar'=> array('compress'=>Phar::GZ, 'metadata' => array(2, 'hi' => 3))));
+$context = stream_context_create(array('phar'=> array('compress'=>Phar::GZ, 'metadata' => array(2, b'hi' => 3))));
$context2 = stream_context_create(array('phar' => array('metadata' => array(4))));
file_put_contents($pname . '/a', b'new a', 0); // no compression
diff --git a/ext/phar/tests/phar_magic.phpt b/ext/phar/tests/phar_magic.phpt
index f6a0a675e..7c60589f9 100644
--- a/ext/phar/tests/phar_magic.phpt
+++ b/ext/phar/tests/phar_magic.phpt
@@ -14,6 +14,9 @@ $p['b/c.php'] = '<?php echo "in b\n";$a = fopen("a", "r", true);echo stream_get_
$p['d'] = "in d\n";
$p->setStub('<?php
set_include_path("phar://" . __FILE__);
+if (version_compare(PHP_VERSION, "5.3", "<")) {
+Phar::interceptFileFuncs();
+}
include "phar://" . __FILE__ . "/a";
__HALT_COMPILER();');
include $fname;
diff --git a/ext/phar/tests/readfile_edgecases.phpt b/ext/phar/tests/readfile_edgecases.phpt
index 1a78d7b5b..2c93c8b22 100644
--- a/ext/phar/tests/readfile_edgecases.phpt
+++ b/ext/phar/tests/readfile_edgecases.phpt
@@ -2,6 +2,7 @@
Phar: test edge cases of readfile() function interception
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
+<?php if (version_compare(PHP_VERSION, "6.0", ">=")) die("skip requires php older than 6.0"); ?>
--INI--
phar.readonly=0
--FILE--
diff --git a/ext/phar/tests/readfile_edgecasesU.phpt b/ext/phar/tests/readfile_edgecasesU.phpt
new file mode 100644
index 000000000..c26b45fc5
--- /dev/null
+++ b/ext/phar/tests/readfile_edgecasesU.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Phar: test edge cases of readfile() function interception
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip");?>
+<?php if (version_compare(PHP_VERSION, "6.0", "<")) die("skip requires php 6.0 or newer"); ?>
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+Phar::interceptFileFuncs();
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
+
+chdir(dirname(__FILE__));
+file_put_contents($fname, "blah\n");
+file_put_contents("foob", "test\n");
+readfile($fname);
+unlink($fname);
+mkdir($pname . '/oops');
+file_put_contents($pname . '/foo/hi', '<?php
+readfile("foo/" . basename(__FILE__));
+$context = stream_context_create();
+readfile("foob");
+set_include_path("' . addslashes(dirname(__FILE__)) . '");
+readfile("foob", true);
+readfile("./hi", 0, $context);
+readfile("../oops");
+?>
+');
+include $pname . '/foo/hi';
+?>
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php rmdir(dirname(__FILE__) . '/poo'); ?>
+<?php unlink(dirname(__FILE__) . '/foob'); ?>
+--EXPECTF--
+blah
+<?php
+readfile("foo/" . basename(__FILE__));
+$context = stream_context_create();
+readfile("foob");
+set_include_path("%stests");
+readfile("foob", true);
+readfile("./hi", 0, $context);
+readfile("../oops");
+?>
+test
+test
+<?php
+readfile("foo/" . basename(__FILE__));
+$context = stream_context_create();
+readfile("foob");
+set_include_path("%stests");
+readfile("foob", true);
+readfile("./hi", 0, $context);
+readfile("../oops");
+?>
+
+Warning: readfile(phar://%sreadfile_edgecasesU.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sreadfile_edgecasesU.phar.php/foo/hi on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/phar/tests/tar/bignames.phpt b/ext/phar/tests/tar/bignames.phpt
index 4b51e2a92..c10b1cea2 100644
--- a/ext/phar/tests/tar/bignames.phpt
+++ b/ext/phar/tests/tar/bignames.phpt
@@ -8,30 +8,50 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar';
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.tar';
+$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.3.tar';
+$fname4 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.4.tar';
$pname = 'phar://' . $fname;
$p1 = new PharData($fname);
-$p1[str_repeat('a', 101)] = 'hi';
-$p1[str_repeat('a', 255)] = 'hi2';
+$p1[str_repeat('a', 100) . '/b'] = 'hi';
+$p1[str_repeat('a', 155) . '/' . str_repeat('b', 100)] = 'hi2';
copy($fname, $fname2);
$p2 = new PharData($fname2);
-echo $p2[str_repeat('a', 101)]->getContent() . "\n";
-echo $p2[str_repeat('a', 255)]->getContent() . "\n";
+echo $p2[str_repeat('a', 100) . '/b']->getContent() . "\n";
+echo $p2[str_repeat('a', 155) . '/' . str_repeat('b', 100)]->getContent() . "\n";
try {
$p2[str_repeat('a', 400)] = 'yuck';
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
+
+try {
+ $p2 = new PharData($fname3);
+ $p2[str_repeat('a', 101)] = 'yuck';
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $p2 = new PharData($fname4);
+ $p2[str_repeat('b', 160) . '/' . str_repeat('a', 90)] = 'yuck';
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar');
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.tar');
+@unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.3.tar');
+@unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.4.tar');
?>
--EXPECTF--
hi
hi2
tar-based phar "%sbignames.2.tar" cannot be created, filename "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
+tar-based phar "%sbignames.3.tar" cannot be created, filename "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
+tar-based phar "%sbignames.4.tar" cannot be created, filename "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
===DONE===
diff --git a/ext/phar/tests/tar/bignames_overflow.phpt b/ext/phar/tests/tar/bignames_overflow.phpt
index 80873119f..359e9c634 100644
--- a/ext/phar/tests/tar/bignames_overflow.phpt
+++ b/ext/phar/tests/tar/bignames_overflow.phpt
@@ -22,8 +22,8 @@ $p1 = new PharData($fname);
foreach ($p1 as $file) {
echo $file->getFileName(), "\n";
}
-echo $p1[str_repeat('a', 101)]->getContent() . "\n";
-echo $p1[str_repeat('a', 255)]->getContent() . "\n";
+echo $p1['a/' . str_repeat('a', 100)]->getContent() . "\n";
+echo $p1[str_repeat('a', 155) . '/' . str_repeat('a', 100)]->getContent() . "\n";
?>
===DONE===
@@ -33,8 +33,8 @@ unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar');
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.tar');
?>
--EXPECT--
-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+a
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hi
hi2
===DONE===
diff --git a/ext/phar/tests/tar/bug49910.phpt b/ext/phar/tests/tar/bug49910.phpt
new file mode 100644
index 000000000..6fb66a50a
--- /dev/null
+++ b/ext/phar/tests/tar/bug49910.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #49910: no support for ././@LongLink for long filenames in phar tar support
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("zlib")) die("skip"); ?>
+--FILE--
+<?php
+$fname = str_replace('\\', '/', dirname(__FILE__) . '/files/Structures_Graph-1.0.3.tgz');
+$tar = new PharData($fname);
+$files = array();
+foreach (new RecursiveIteratorIterator($tar) as $file) {
+ $files[] = str_replace($fname, '*', $file->getPathName());
+}
+print_r($files);
+?>
+===DONE===
+--EXPECT--
+Array
+(
+ [0] => phar://*/Structures_Graph-1.0.3/LICENSE
+ [1] => phar://*/Structures_Graph-1.0.3/Structures/Graph/Manipulator/AcyclicTest.php
+ [2] => phar://*/Structures_Graph-1.0.3/Structures/Graph/Manipulator/TopologicalSorter.php
+ [3] => phar://*/Structures_Graph-1.0.3/Structures/Graph/Node.php
+ [4] => phar://*/Structures_Graph-1.0.3/Structures/Graph.php
+ [5] => phar://*/Structures_Graph-1.0.3/docs/generate.sh
+ [6] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph.html
+ [7] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html
+ [8] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html
+ [9] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph_Node.html
+ [10] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html
+ [11] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html
+ [12] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_Node_php.html
+ [13] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_php.html
+ [14] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html
+ [15] => phar://*/Structures_Graph-1.0.3/docs/html/classtrees_Structures_Graph.html
+ [16] => phar://*/Structures_Graph-1.0.3/docs/html/elementindex.html
+ [17] => phar://*/Structures_Graph-1.0.3/docs/html/elementindex_Structures_Graph.html
+ [18] => phar://*/Structures_Graph-1.0.3/docs/html/errors.html
+ [19] => phar://*/Structures_Graph-1.0.3/docs/html/index.html
+ [20] => phar://*/Structures_Graph-1.0.3/docs/html/li_Structures_Graph.html
+ [21] => phar://*/Structures_Graph-1.0.3/docs/html/media/banner.css
+ [22] => phar://*/Structures_Graph-1.0.3/docs/html/media/stylesheet.css
+ [23] => phar://*/Structures_Graph-1.0.3/docs/html/packages.html
+ [24] => phar://*/Structures_Graph-1.0.3/docs/html/todolist.html
+ [25] => phar://*/Structures_Graph-1.0.3/docs/tutorials/Structures_Graph/Structures_Graph.pkg
+ [26] => phar://*/Structures_Graph-1.0.3/tests/AllTests.php
+ [27] => phar://*/Structures_Graph-1.0.3/tests/testCase/BasicGraph.php
+ [28] => phar://*/package.xml
+)
+===DONE===
diff --git a/ext/phar/tests/tar/files/P1-1.0.0.tgz b/ext/phar/tests/tar/files/P1-1.0.0.tgz
new file mode 100644
index 000000000..1d9cae439
--- /dev/null
+++ b/ext/phar/tests/tar/files/P1-1.0.0.tgz
Binary files differ
diff --git a/ext/phar/tests/tar/files/P1-1.0.0.tgz.pubkey b/ext/phar/tests/tar/files/P1-1.0.0.tgz.pubkey
new file mode 100644
index 000000000..eb59bdd26
--- /dev/null
+++ b/ext/phar/tests/tar/files/P1-1.0.0.tgz.pubkey
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4drcwddPs6LmIbdT1ifT
+Ev8HXh1Fk1yNusCDoCX6mYkgqvCmx02F/9k5q7n6CPblTcF5mdDI8kcRrUHmyXtD
+9X0d7RN7BakZMPH5KPaNkXiXsI9YGSb39AnZgYw01n6u0W6Ohha+KwOsrxkKCF4u
+LjPLQAlM+3uD8y9Tz2fF+pAE901kHrd3ue7a5i5EtW0bzl5QfxnwFZXAO0StQ9dF
+slzibRH+1pFjMRxDnlgYmLQF6jMWm9Ty6x9UH9HZ3E3F9QZEQVXWT9y/pe30HcAX
+YxAGZjPIx19UNPF5C+Nps6MjxNRht0pGXTL9sptYoiNjRiXAS0y4FM+8K6xvBIOF
+ZQIDAQAB
+-----END PUBLIC KEY-----
diff --git a/ext/phar/tests/tar/files/Structures_Graph-1.0.3.tgz b/ext/phar/tests/tar/files/Structures_Graph-1.0.3.tgz
new file mode 100644
index 000000000..fa14f0c6a
--- /dev/null
+++ b/ext/phar/tests/tar/files/Structures_Graph-1.0.3.tgz
Binary files differ
diff --git a/ext/phar/tests/tar/files/frontcontroller12.phar.inc b/ext/phar/tests/tar/files/frontcontroller12.phar.inc
index 693ef0aa0..0a9422a29 100644
--- a/ext/phar/tests/tar/files/frontcontroller12.phar.inc
+++ b/ext/phar/tests/tar/files/frontcontroller12.phar.inc
@@ -3,13 +3,13 @@
$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"]);
+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"));
diff --git a/ext/phar/tests/tar/files/frontcontroller12.phar.tar b/ext/phar/tests/tar/files/frontcontroller12.phar.tar
index e0f22f5f4..e945e49bd 100644
--- a/ext/phar/tests/tar/files/frontcontroller12.phar.tar
+++ b/ext/phar/tests/tar/files/frontcontroller12.phar.tar
Binary files differ
diff --git a/ext/phar/tests/tar/files/frontcontroller3.phar.inc b/ext/phar/tests/tar/files/frontcontroller3.phar.inc
index 9729d0065..800f65e81 100644
--- a/ext/phar/tests/tar/files/frontcontroller3.phar.inc
+++ b/ext/phar/tests/tar/files/frontcontroller3.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => "a.phps");
+ static $b = array(b"/hi" => b"a.phps");
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/tar/files/frontcontroller3.phar.tar b/ext/phar/tests/tar/files/frontcontroller3.phar.tar
index 2df61c95a..16853bd10 100644
--- a/ext/phar/tests/tar/files/frontcontroller3.phar.tar
+++ b/ext/phar/tests/tar/files/frontcontroller3.phar.tar
Binary files differ
diff --git a/ext/phar/tests/tar/files/frontcontroller4.phar.inc b/ext/phar/tests/tar/files/frontcontroller4.phar.inc
index eb1d56f0d..bfb9b4104 100644
--- a/ext/phar/tests/tar/files/frontcontroller4.phar.inc
+++ b/ext/phar/tests/tar/files/frontcontroller4.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => false);
+ static $b = array(b"/hi" => false);
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/tar/files/frontcontroller4.phar.tar b/ext/phar/tests/tar/files/frontcontroller4.phar.tar
index 4cd684d25..5a1d4ee10 100644
--- a/ext/phar/tests/tar/files/frontcontroller4.phar.tar
+++ b/ext/phar/tests/tar/files/frontcontroller4.phar.tar
Binary files differ
diff --git a/ext/phar/tests/tar/frontcontroller21.phar.phpt b/ext/phar/tests/tar/frontcontroller21.phar.phpt
index c1a299cc9..bb93996d6 100644
--- a/ext/phar/tests/tar/frontcontroller21.phar.phpt
+++ b/ext/phar/tests/tar/frontcontroller21.phar.phpt
@@ -14,7 +14,7 @@ files/frontcontroller12.phar.tar
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
-string(10) "/index.php"
+%unicode|string%(10) "/index.php"
string(10) "/index.php"
string(%d) "phar://%sfrontcontroller21.phar.php/index.php"
string(18) "/index.php?test=hi"
diff --git a/ext/phar/tests/tar/phar_convert_phar4.phpt b/ext/phar/tests/tar/phar_convert_phar4.phpt
index f23780e1a..9b095f11c 100644
--- a/ext/phar/tests/tar/phar_convert_phar4.phpt
+++ b/ext/phar/tests/tar/phar_convert_phar4.phpt
@@ -14,7 +14,7 @@ $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.phar';
$phar = new Phar($fname);
$phar['a.txt'] = 'some text';
-$phar->setMetadata('hi');
+$phar->setMetadata(b'hi');
$phar->stopBuffering();
var_dump($phar->isFileFormat(Phar::TAR));
var_dump(strlen($phar->getStub()));
diff --git a/ext/phar/tests/tar/phar_magic.phpt b/ext/phar/tests/tar/phar_magic.phpt
index 1bb336f96..ed0a46297 100644
--- a/ext/phar/tests/tar/phar_magic.phpt
+++ b/ext/phar/tests/tar/phar_magic.phpt
@@ -15,6 +15,9 @@ $p['b/c.php'] = '<?php echo "in b\n";$a = fopen("a", "r", true);echo stream_get_
$p['d'] = "in d\n";
$p->setStub('<?php
set_include_path("phar://" . __FILE__);
+if (version_compare(PHP_VERSION, "5.3", "<")) {
+Phar::interceptFileFuncs();
+}
include "phar://" . __FILE__ . "/a";
__HALT_COMPILER();');
include $fname;
diff --git a/ext/phar/tests/tar/tar_openssl_hash.phpt b/ext/phar/tests/tar/tar_openssl_hash.phpt
new file mode 100644
index 000000000..49ef77a44
--- /dev/null
+++ b/ext/phar/tests/tar/tar_openssl_hash.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Phar: tar archive, require_hash=1, OpenSSL hash
+--SKIPIF--
+<?php if (!extension_loaded('phar')) die('skip'); ?>
+<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
+<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
+<?php if (!extension_loaded("openssl")) die("skip openssl not available"); ?>
+--INI--
+phar.readonly=1
+phar.require_hash=1
+--FILE--
+<?php
+try {
+ $phar = new PharData(dirname(__FILE__) . '/files/P1-1.0.0.tgz');
+} catch (Exception $e) {
+ echo $e->getMessage()."\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/phar/tests/zip/all.phpt b/ext/phar/tests/zip/all.phpt
index 7fcb5f368..49d79a44c 100644
--- a/ext/phar/tests/zip/all.phpt
+++ b/ext/phar/tests/zip/all.phpt
@@ -46,6 +46,7 @@ var_dump($phar['a']->getMetadata());
?>
===DONE===
--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip.php'); ?>
--EXPECT--
bool(false)
diff --git a/ext/phar/tests/zip/bug48791.phpt b/ext/phar/tests/zip/bug48791.phpt
new file mode 100644
index 000000000..45c527188
--- /dev/null
+++ b/ext/phar/tests/zip/bug48791.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Phar: Bug #48791: open office documents always reported as corrupted by phar extension
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
+<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
+--FILE--
+<?php
+echo file_get_contents('phar://' . dirname(__FILE__) . '/files/test.odt/content.xml'), "\n";
+?>
+===DONE===
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:rdfa="http://docs.oasis-open.org/opendocument/meta/rdfa#" office:version="1.2"><office:scripts/><office:font-face-decls><style:font-face style:name="OpenSymbol" svg:font-family="OpenSymbol"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Times New Roman" svg:font-family="&apos;Times New Roman&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Arial Unicode MS" svg:font-family="&apos;Arial Unicode MS&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="MS Mincho" svg:font-family="&apos;MS Mincho&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard" style:list-style-name="L1"/><style:style style:name="T1" style:family="text"><style:text-properties style:font-name="Arial"/></style:style><text:list-style style:name="L1"><text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.27cm" fo:text-indent="-0.635cm" fo:margin-left="1.27cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="◦"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.905cm" fo:text-indent="-0.635cm" fo:margin-left="1.905cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="▪"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-0.635cm" fo:margin-left="2.54cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.175cm" fo:text-indent="-0.635cm" fo:margin-left="3.175cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="◦"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.81cm" fo:text-indent="-0.635cm" fo:margin-left="3.81cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="▪"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="4.445cm" fo:text-indent="-0.635cm" fo:margin-left="4.445cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.08cm" fo:text-indent="-0.635cm" fo:margin-left="5.08cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="◦"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.715cm" fo:text-indent="-0.635cm" fo:margin-left="5.715cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="▪"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.35cm" fo:text-indent="-0.635cm" fo:margin-left="6.35cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.985cm" fo:text-indent="-0.635cm" fo:margin-left="6.985cm"/></style:list-level-properties></text:list-level-style-bullet></text:list-style></office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:h text:style-name="Heading_20_1" text:outline-level="1">Überschrift</text:h><text:list xml:id="list38593008" text:style-name="L1"><text:list-item><text:p text:style-name="P1"><text:span text:style-name="T1">Name:<text:tab/><text:tab/>$$n_fn$$</text:span></text:p></text:list-item><text:list-item><text:p text:style-name="P1"><text:span text:style-name="T1">Firma:<text:tab/><text:tab/>$$org_name$$</text:span></text:p></text:list-item><text:list-item><text:p text:style-name="P1"><text:span text:style-name="T1">Menge:<text:tab/>$$#menge$$</text:span></text:p></text:list-item></text:list></office:text></office:body></office:document-content>
+===DONE===
diff --git a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc
index 7c3b356c2..b993ff553 100644
--- a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc
+++ b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc
@@ -26,7 +26,7 @@
* @author Vincent Lascaux <vincentlascaux@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.gnu.org/copyleft/lesser.html LGPL
- * @version CVS: $Id: corrupt_zipmaker.php.inc,v 1.5.2.2 2008/08/11 22:43:02 cellog Exp $
+ * @version CVS: $Id: corrupt_zipmaker.php.inc 264655 2008-08-11 22:43:02Z cellog $
* @link http://pear.php.net/package/File_Archive
*/
diff --git a/ext/phar/tests/zip/files/frontcontroller12.phar.inc b/ext/phar/tests/zip/files/frontcontroller12.phar.inc
index 77c4a1dd0..c5f38ffd1 100644
--- a/ext/phar/tests/zip/files/frontcontroller12.phar.inc
+++ b/ext/phar/tests/zip/files/frontcontroller12.phar.inc
@@ -3,13 +3,13 @@
$a = new Phar(dirname(__FILE__) . '/frontcontroller12.phar.zip');
$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"]);
+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"));
diff --git a/ext/phar/tests/zip/files/frontcontroller12.phar.zip b/ext/phar/tests/zip/files/frontcontroller12.phar.zip
index e831e4430..ed9be3d00 100644
--- a/ext/phar/tests/zip/files/frontcontroller12.phar.zip
+++ b/ext/phar/tests/zip/files/frontcontroller12.phar.zip
Binary files differ
diff --git a/ext/phar/tests/zip/files/frontcontroller3.phar.inc b/ext/phar/tests/zip/files/frontcontroller3.phar.inc
index ab28f7b3d..ccd55b73f 100644
--- a/ext/phar/tests/zip/files/frontcontroller3.phar.inc
+++ b/ext/phar/tests/zip/files/frontcontroller3.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => "a.phps");
+ static $b = array(b"/hi" => b"a.phps");
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/zip/files/frontcontroller3.phar.zip b/ext/phar/tests/zip/files/frontcontroller3.phar.zip
index f167f2f6e..6f35a8042 100644
--- a/ext/phar/tests/zip/files/frontcontroller3.phar.zip
+++ b/ext/phar/tests/zip/files/frontcontroller3.phar.zip
Binary files differ
diff --git a/ext/phar/tests/zip/files/frontcontroller4.phar.inc b/ext/phar/tests/zip/files/frontcontroller4.phar.inc
index d78399142..9f664cf2c 100644
--- a/ext/phar/tests/zip/files/frontcontroller4.phar.inc
+++ b/ext/phar/tests/zip/files/frontcontroller4.phar.inc
@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
- static $b = array("/hi" => false);
+ static $b = array(b"/hi" => false);
if (isset($b[$a])) return $b[$a];
return $a;
}
diff --git a/ext/phar/tests/zip/files/frontcontroller4.phar.zip b/ext/phar/tests/zip/files/frontcontroller4.phar.zip
index 1ad83f8a6..fb27ccb0b 100644
--- a/ext/phar/tests/zip/files/frontcontroller4.phar.zip
+++ b/ext/phar/tests/zip/files/frontcontroller4.phar.zip
Binary files differ
diff --git a/ext/phar/tests/zip/files/test.odt b/ext/phar/tests/zip/files/test.odt
new file mode 100644
index 000000000..c5cefe58e
--- /dev/null
+++ b/ext/phar/tests/zip/files/test.odt
Binary files differ
diff --git a/ext/phar/tests/zip/frontcontroller21.phar.phpt b/ext/phar/tests/zip/frontcontroller21.phar.phpt
index d0a16c5d9..74caa2c81 100644
--- a/ext/phar/tests/zip/frontcontroller21.phar.phpt
+++ b/ext/phar/tests/zip/frontcontroller21.phar.phpt
@@ -15,7 +15,7 @@ files/frontcontroller12.phar.zip
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
-string(10) "/index.php"
+%unicode|string%(10) "/index.php"
string(10) "/index.php"
string(%d) "phar://%sfrontcontroller21.phar.php/index.php"
string(18) "/index.php?test=hi"
diff --git a/ext/phar/tests/zip/phar_magic.phpt b/ext/phar/tests/zip/phar_magic.phpt
index a56639d7e..694f92777 100644
--- a/ext/phar/tests/zip/phar_magic.phpt
+++ b/ext/phar/tests/zip/phar_magic.phpt
@@ -21,6 +21,9 @@ $p->setStub('<?php
var_dump(__FILE__);
var_dump(substr(__FILE__, 0, 4) != "phar");
set_include_path("phar://" . __FILE__);
+if (version_compare(PHP_VERSION, "5.3", "<")) {
+Phar::interceptFileFuncs();
+}
include "phar://" . __FILE__ . "/a";
__HALT_COMPILER();');
include $pname;
diff --git a/ext/phar/tests/zip/phar_setsignaturealgo2.phpt b/ext/phar/tests/zip/phar_setsignaturealgo2.phpt
new file mode 100644
index 000000000..372f7ddc8
--- /dev/null
+++ b/ext/phar/tests/zip/phar_setsignaturealgo2.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Phar::setSupportedSignatures() with hash, zip-based
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("hash")) die("skip extension hash required");
+$arr = Phar::getSupportedSignatures();
+if (!in_array("OpenSSL", $arr)) die("skip openssl support required");
+if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared"); ?>
+--INI--
+phar.require_hash=0
+phar.readonly=0
+--FILE--
+<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
+$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.zip';
+$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.3.phar.zip';
+$fname4 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.4.phar.zip';
+$fname5 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.5.phar.zip';
+$fname6 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.6.phar.zip';
+$p = new Phar($fname);
+$p['file1.txt'] = 'hi';
+var_dump($p->getSignature());
+$p->setSignatureAlgorithm(Phar::MD5);
+
+copy($fname, $fname2);
+$p = new Phar($fname2);
+var_dump($p->getSignature());
+
+$p->setSignatureAlgorithm(Phar::SHA1);
+
+copy($fname2, $fname3);
+$p = new Phar($fname3);
+var_dump($p->getSignature());
+
+try {
+$p->setSignatureAlgorithm(Phar::SHA256);
+copy($fname3, $fname4);
+$p = new Phar($fname4);
+var_dump($p->getSignature());
+} catch (Exception $e) {
+echo $e->getMessage();
+}
+try {
+$p->setSignatureAlgorithm(Phar::SHA512);
+copy($fname4, $fname5);
+$p = new Phar($fname5);
+var_dump($p->getSignature());
+} catch (Exception $e) {
+echo $e->getMessage();
+}
+try {
+$keys=openssl_pkey_new();
+openssl_pkey_export($keys, $privkey);
+$pubkey=openssl_pkey_get_details($keys);
+$p->setSignatureAlgorithm(Phar::OPENSSL, $privkey);
+
+copy($fname5, $fname6);
+file_put_contents($fname6 . '.pubkey', $pubkey['key']);
+$p = new Phar($fname6);
+var_dump($p->getSignature());
+} catch (Exception $e) {
+echo $e->getMessage();
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.3.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.4.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.5.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.6.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.6.phar.zip.pubkey');
+?>
+--EXPECTF--
+array(2) {
+ ["hash"]=>
+ string(%d) "%s"
+ ["hash_type"]=>
+ string(5) "SHA-1"
+}
+array(2) {
+ ["hash"]=>
+ string(%d) "%s"
+ ["hash_type"]=>
+ string(3) "MD5"
+}
+array(2) {
+ ["hash"]=>
+ string(%d) "%s"
+ ["hash_type"]=>
+ string(5) "SHA-1"
+}
+array(2) {
+ ["hash"]=>
+ string(%d) "%s"
+ ["hash_type"]=>
+ string(7) "SHA-256"
+}
+array(2) {
+ ["hash"]=>
+ string(%d) "%s"
+ ["hash_type"]=>
+ string(7) "SHA-512"
+}
+array(2) {
+ ["hash"]=>
+ string(%d) "%s"
+ ["hash_type"]=>
+ string(7) "OpenSSL"
+}
+===DONE===