- MFH Bring phar tests into line across all branches

This commit is contained in:
Steph Fox 2008-08-01 13:38:48 +00:00
parent cb10c3be61
commit 377ff97abd
209 changed files with 8945 additions and 476 deletions

View File

@ -6,7 +6,7 @@ Phar::mapPhar too many manifest entries
phar.require_hash=0
--FILE--
<?php
$file = "<?php
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$file .= pack('VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . str_repeat('A', 500);

View File

@ -6,13 +6,13 @@ Phar::mapPhar buffer overrun
phar.require_hash=0
--FILE--
<?php
$file = "<?php
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
// this fails because the manifest length does not include the other 10 byte manifest data
$manifest = pack('V', 1) . 'a' . pack('VVVVVV', 0, time(), 0, crc32(''), 0x00000000, 0);
$manifest = pack('V', 1) . 'a' . pack('VVVVVV', 0, time(), 0, crc32(b''), 0x00000000, 0);
$file .= pack('VVnVV', strlen($manifest), 1, 0x1000, 0x00000000, 3) . 'hio' . pack('V', 0) . $manifest;
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);

View File

@ -12,7 +12,7 @@ $file = "<?php __HALT_COMPILER(); ?>";
// wrong crc32
$files = array();
$files['a'] = array('cont'=>'a', 'crc32'=>crc32('aX'));
$files['a'] = array('cont'=>'a', 'crc32'=>crc32(b'aX'));
include 'files/phar_test.inc';
echo file_get_contents($pname.'/a');

View File

@ -1,7 +1,10 @@
--TEST--
Phar: opendir test - no dir specified at all
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?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
--FILE--

34
ext/phar/tests/017U.phpt Normal file
View File

@ -0,0 +1,34 @@
--TEST--
Phar: opendir test - no dir specified at all
--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
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = b"<?php
Phar::mapPhar('hio');
var_dump(__FILE__);
var_dump(substr(__FILE__, 0, 4) != 'phar');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'abc';
include 'files/phar_test.inc';
include $pname;
$dir = opendir('phar://hio');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
unicode(%d) "%s017U.phar.php"
bool(true)
Warning: opendir(phar://hio): failed to open dir: phar error: no directory in "phar://hio", must have at least phar://hio/ for root directory (always use full path to a new phar)
phar url "phar://hio" is unknown in %s017U.php on line %d

View File

@ -1,7 +1,10 @@
--TEST--
Phar: opendir test, root directory
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?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
--FILE--

36
ext/phar/tests/018U.phpt Normal file
View File

@ -0,0 +1,36 @@
--TEST--
Phar: opendir test, root directory
--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
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
include 'files/phar_test.inc';
include $fname;
$dir = opendir('phar://hio/');
while (false !== ($a = readdir($dir))) {
var_dump($a);
var_dump(is_dir('phar://hio/' . $a));
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
unicode(1) "a"
bool(false)
unicode(1) "b"
bool(true)

View File

@ -6,9 +6,10 @@ Phar: opendir test, subdirectory
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@ -17,18 +18,24 @@ $files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'files/phar_test.inc';
include $fname;
$dir = opendir('phar://hio/b');
while (false !== ($a = readdir($dir))) {
var_dump($a);
var_dump(is_dir('phar://hio/b/' . $a));
if ($dir) {
while (false !== ($a = readdir($dir))) {
var_dump($a);
var_dump(is_dir('phar://hio/b/' . $a));
}
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
--EXPECTF--
%s(1) "a"
bool(false)
string(1) "c"
bool(true)
%s(1) "c"
bool(true)

View File

@ -1,7 +1,10 @@
--TEST--
Phar: opendir test, recurse into
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?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
--FILE--

70
ext/phar/tests/019bU.phpt Normal file
View File

@ -0,0 +1,70 @@
--TEST--
Phar: opendir test, recurse into
--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
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'files/phar_test.inc';
include $fname;
function dump($phar, $base)
{
var_dump($phar . $base);
$dir = opendir($phar . $base);
if ($base == '/')
{
$base = '';
}
while (false !== ($entry = readdir($dir))) {
$entry = $base . '/' . $entry;
var_dump($entry);
var_dump(is_dir($phar . $entry));
if (is_dir($phar . $entry))
{
dump($phar, $entry);
}
}
}
dump('phar://hio', '/');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
unicode(11) "phar://hio/"
unicode(2) "/a"
bool(false)
unicode(2) "/b"
bool(true)
unicode(12) "phar://hio/b"
unicode(4) "/b/a"
bool(false)
unicode(4) "/b/c"
bool(true)
unicode(14) "phar://hio/b/c"
unicode(6) "/b/c/d"
bool(false)
unicode(4) "/bad"
bool(true)
unicode(14) "phar://hio/bad"
unicode(6) "/bad/c"
bool(false)

View File

@ -1,7 +1,10 @@
--TEST--
Phar: opendir test, recurse into
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?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
--FILE--

76
ext/phar/tests/019cU.phpt Normal file
View File

@ -0,0 +1,76 @@
--TEST--
Phar: opendir test, recurse into
--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
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'files/phar_test.inc';
include $fname;
function dump($phar, $base)
{
var_dump($phar . $base);
$dir = opendir($phar . $base);
if ($base == '/')
{
$base = '';
}
while (false !== ($entry = readdir($dir))) {
$entry = $base . '/' . $entry;
var_dump($entry);
var_dump(is_dir($phar . $entry));
if (is_dir($phar . $entry))
{
dump($phar, $entry);
}
else
{
var_dump(file_get_contents($phar . $entry));
}
}
}
dump('phar://hio', '/');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
unicode(11) "phar://hio/"
unicode(2) "/a"
bool(false)
string(1) "a"
unicode(2) "/b"
bool(true)
unicode(12) "phar://hio/b"
unicode(4) "/b/a"
bool(false)
string(1) "b"
unicode(4) "/b/c"
bool(true)
unicode(14) "phar://hio/b/c"
unicode(6) "/b/c/d"
bool(false)
string(1) "c"
unicode(4) "/bad"
bool(true)
unicode(14) "phar://hio/bad"
unicode(6) "/bad/c"
bool(false)
string(1) "d"

View File

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@ -53,31 +53,31 @@ array(26) {
int(-1)
[12]=>
int(-1)
["dev"]=>
[%sdev"]=>
int(12)
["ino"]=>
[%sino"]=>
int(%d)
["mode"]=>
[%smode"]=>
int(33060)
["nlink"]=>
[%snlink"]=>
int(1)
["uid"]=>
[%suid"]=>
int(0)
["gid"]=>
[%sgid"]=>
int(0)
["rdev"]=>
[%srdev"]=>
int(-1)
["size"]=>
[%ssize"]=>
int(1)
["atime"]=>
[%satime"]=>
int(%d)
["mtime"]=>
[%smtime"]=>
int(%d)
["ctime"]=>
[%sctime"]=>
int(%d)
["blksize"]=>
[%sblksize"]=>
int(-1)
["blocks"]=>
[%sblocks"]=>
int(-1)
}
array(26) {
@ -107,30 +107,30 @@ array(26) {
int(-1)
[12]=>
int(-1)
["dev"]=>
[%sdev"]=>
int(12)
["ino"]=>
[%sino"]=>
int(%d)
["mode"]=>
[%smode"]=>
int(16749)
["nlink"]=>
[%snlink"]=>
int(1)
["uid"]=>
[%suid"]=>
int(0)
["gid"]=>
[%sgid"]=>
int(0)
["rdev"]=>
[%srdev"]=>
int(-1)
["size"]=>
[%ssize"]=>
int(0)
["atime"]=>
[%satime"]=>
int(%d)
["mtime"]=>
[%smtime"]=>
int(%d)
["ctime"]=>
[%sctime"]=>
int(%d)
["blksize"]=>
[%sblksize"]=>
int(-1)
["blocks"]=>
[%sblocks"]=>
int(-1)
}

View File

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = b"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@ -56,30 +56,30 @@ array(26) {
int(-1)
[12]=>
int(-1)
["dev"]=>
[%sdev"]=>
int(12)
["ino"]=>
[%sino"]=>
int(%d)
["mode"]=>
[%smode"]=>
int(33060)
["nlink"]=>
[%snlink"]=>
int(1)
["uid"]=>
[%suid"]=>
int(0)
["gid"]=>
[%sgid"]=>
int(0)
["rdev"]=>
[%srdev"]=>
int(-1)
["size"]=>
[%ssize"]=>
int(1)
["atime"]=>
[%satime"]=>
int(%d)
["mtime"]=>
[%smtime"]=>
int(%d)
["ctime"]=>
[%sctime"]=>
int(%d)
["blksize"]=>
[%sblksize"]=>
int(-1)
["blocks"]=>
[%sblocks"]=>
int(-1)
}

View File

@ -1,7 +1,10 @@
--TEST--
Phar: phar:// opendir
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?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
--FILE--
@ -11,11 +14,11 @@ $pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; require \''.$pname.'/b.php\'; ?>';
$files['b.php'] = '<?php echo "This is b\n"; require \''.$pname.'/b/c.php\'; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; require \''.$pname.'/b/d.php\'; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; require \''.$pname.'/e.php\'; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
$files['a.php'] = '<?php echo "This is a\n"; require \''.$pname.'/b.php\'; ?>';
$files['b.php'] = '<?php echo "This is b\n"; require \''.$pname.'/b/c.php\'; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; require \''.$pname.'/b/d.php\'; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; require \''.$pname.'/e.php\'; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
include 'files/phar_test.inc';

97
ext/phar/tests/027U.phpt Normal file
View File

@ -0,0 +1,97 @@
--TEST--
Phar: phar:// opendir
--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
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = b"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; require \''.$pname.'/b.php\'; ?>';
$files['b.php'] = '<?php echo "This is b\n"; require \''.$pname.'/b/c.php\'; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; require \''.$pname.'/b/d.php\'; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; require \''.$pname.'/e.php\'; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
include 'files/phar_test.inc';
function dump($phar, $base)
{
var_dump(str_replace(dirname(__FILE__), '*', $phar) . $base);
$dir = opendir($phar . $base);
if ($base == '/')
{
$base = '';
}
while (false !== ($entry = readdir($dir))) {
$entry = $base . '/' . $entry;
var_dump($entry);
var_dump(is_dir($phar . $entry));
if (is_dir($phar . $entry))
{
dump($phar, $entry);
}
}
}
dump($pname, '/');
$a = opendir($pname);
// this may stop working in future versions, but is here for code coverage purposes
echo "fseek on dir handle\n";
var_dump(fseek($a, 0, SEEK_END), ftell($a));
var_dump(fseek($a, -1), ftell($a));
var_dump(fseek($a, 1), ftell($a));
echo "fwrite on dir handle\n";
var_dump(fwrite($a, b'hi'));
var_dump(fstat($a));
closedir($a);
echo "opendir edge cases\n";
var_dump(opendir("phar://"));
var_dump(opendir("phar://foo.phar/hi"));
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
unicode(%d) "phar://*/027U.phar.php/"
unicode(6) "/a.php"
bool(false)
unicode(2) "/b"
bool(true)
unicode(%d) "phar://*/027U.phar.php/b"
unicode(8) "/b/c.php"
bool(false)
unicode(8) "/b/d.php"
bool(false)
unicode(6) "/b.php"
bool(false)
unicode(6) "/e.php"
bool(false)
fseek on dir handle
int(0)
int(4)
int(-1)
int(4)
int(0)
int(1)
fwrite on dir handle
int(0)
bool(false)
opendir edge cases
Warning: opendir(phar://): failed to open dir: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar)
phar url "phar://" is unknown in %s027U.php on line %d
bool(false)
Warning: opendir(phar://foo.phar/hi): failed to open dir: phar error: invalid url or non-existent phar "phar://foo.phar/hi"
phar url "phar://foo.phar/hi" is unknown in %s027U.php on line %d
bool(false)
===DONE===

View File

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = b'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';

View File

@ -129,35 +129,35 @@ echo $e->getMessage() . "\n";
?>
===DONE===
--EXPECTF--
Warning: Phar::mungServer() expects parameter 1 to be array, string given in %sbadparameters.php on line %d
Warning: Phar::mungServer() expects parameter 1 to be array, %string given in %sbadparameters.php on line %d
Warning: Phar::createDefaultStub() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::createDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::loadPhar() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::loadPhar() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::canCompress() expects parameter 1 to be long, string given in %sbadparameters.php on line %d
Warning: Phar::canCompress() expects parameter 1 to be long, %string given in %sbadparameters.php on line %d
Warning: Phar::__construct() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::__construct() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::convertToExecutable() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
Warning: Phar::convertToData() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
Warning: PharData::delete() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: PharData::delete() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Cannot write out phar archive, phar is read-only
Entry oops does not exist and cannot be deleted
%sfiles/frontcontroller10.phar
Cannot write out phar archive, phar is read-only
A Phar alias cannot be set in a plain tar archive
Warning: Phar::setAlias() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::setAlias() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Cannot change stub, phar is read-only
A Phar stub cannot be set in a plain tar archive
Warning: Phar::setStub() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::setStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
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
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
@ -171,18 +171,18 @@ Phar is readonly, cannot change compression
Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Cannot copy "a" to "b", phar is read-only
Warning: Phar::offsetExists() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetExists() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetGet() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetGet() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Warning: PharData::offsetUnset() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: PharData::offsetUnset() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Write operations disabled by INI setting
Warning: Phar::addEmptyDir() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::addEmptyDir() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::addFile() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::addFile() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Write operations disabled by INI setting

View File

@ -1,8 +1,11 @@
--TEST--
Phar::buildFromIterator() iterator, too many files for open file handles (Bug #45218)
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php if (getenv('SKIP_SLOW_TESTS')) die('skip'); ?>
<?php
if (!extension_loaded("phar")) die("skip");
if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
?>
--INI--
phar.require_hash=0
phar.readonly=0

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller rewrite access denied [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller10.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/hi
--FILE_EXTERNAL--
files/frontcontroller4.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
Status: 403 Access Denied
--EXPECT--
<html>

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type extension is not a string [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller11.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -13,7 +13,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller5.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Key of MIME type overrides array must be a file extension, was "0"' in %sfrontcontroller11.php:2
Stack trace:

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type unknown int [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller12.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller6.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed' in %sfrontcontroller12.php:2
Stack trace:

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type not string/int [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller13.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller7.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed' in %sfrontcontroller13.php:2
Stack trace:

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type override, Phar::PHPS [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller15.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type override, Phar::PHP [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller16.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/a.phps
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
hio1

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller PHP test [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list=frontcontroller2.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,6 +12,6 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
hio

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller $_SERVER munging success [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller21.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -13,7 +13,7 @@ QUERY_STRING=test=hi
--FILE_EXTERNAL--
files/frontcontroller12.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(10) "/index.php"
string(10) "/index.php"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller include from cwd test 1 [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller22.phpt
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/index.php
--FILE_EXTERNAL--
files/frontcontroller13.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(4) "test"
string(12) "oof/test.php"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with generic action router test [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller23.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/hi/there
--FILE_EXTERNAL--
files/frontcontroller14.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(9) "/hi/there"
string(%d) "phar://%sfrontcontroller23.php/html/index.php"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with custom 404 php script [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller24.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,6 +12,6 @@ PATH_INFO=/unknown/file
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
My 404 is rawesome

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with extra path_info [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller25.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/a1.phps/extra/stuff
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(42) "/frontcontroller25.php/a1.phps/extra/stuff"
string(12) "/extra/stuff"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with no extension [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller27.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,6 +12,6 @@ PATH_INFO=/noext
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/plain
Content-type: text/plain;charset=UTF-8
--EXPECTF--
hi

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with fatal error in php file [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller29.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,6 +12,6 @@ PATH_INFO=/fatalerror.phps
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Call to undefined function oopsie_daisy() in phar://%sfatalerror.phps on line 1

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller phps [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller3.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/a.phps
--FILE_EXTERNAL--
files/frontcontroller.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with invalid callback for rewrites [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller31.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -9,7 +9,7 @@ phar.cache_list={PWD}/frontcontroller31.php
SCRIPT_NAME=/frontcontroller31.php
REQUEST_URI=/frontcontroller31.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller16.phar
--EXPECT--

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with valid callback that is not good [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller32.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -9,7 +9,7 @@ phar.cache_list={PWD}/frontcontroller32.php
SCRIPT_NAME=/frontcontroller32.php
REQUEST_URI=/frontcontroller32.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller17.phar
--EXPECTF--

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with valid callback that does not return any value [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller33.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -9,7 +9,7 @@ phar.cache_list={PWD}/frontcontroller33.php
SCRIPT_NAME=/frontcontroller33.php
REQUEST_URI=/frontcontroller33.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller18.phar
--EXPECTF--

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with cwd [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller34.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -10,7 +10,7 @@ SCRIPT_NAME=/frontcontroller34.php
REQUEST_URI=/frontcontroller34.php/start/index.php
PATH_INFO=/start/index.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller19.phar
--EXPECT--

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller rewrite array [cache_list]
--INI--
default_charset=
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller9.php
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
@ -12,7 +12,7 @@ PATH_INFO=/hi
--FILE_EXTERNAL--
files/frontcontroller3.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View File

@ -1,7 +1,10 @@
--TEST--
Phar: phar.cache_list basic read test
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php
if (!extension_loaded("phar")) die("skip");
if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
?>
--INI--
phar.cache_list={$cwd}/files/nophar.phar
--FILE--
@ -26,10 +29,10 @@ string(1) "b"
string(1) "d"
string(9) "index.php"
string(7) "web.php"
string(%d) "phar://%snophar.phar/b/c.php"
string(%d) "phar://%snophar.phar/d"
string(%d) "phar://%snophar.phar/index.php"
string(%d) "phar://%snophar.phar/web.php"
string(%d) "phar://%snophar.phar/b%cc.php"
string(%d) "phar://%snophar.phar%cd"
string(%d) "phar://%snophar.phar%cindex.php"
string(%d) "phar://%snophar.phar%cweb.php"
bool(true)
bool(false)
bool(false)

View File

@ -0,0 +1,39 @@
--TEST--
Phar: phar.cache_list basic read test
--SKIPIF--
<?php
if (!extension_loaded("phar")) die("skip");
if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support required");
?>
--INI--
phar.cache_list={$cwd}/files/nophar.phar
--FILE--
<?php
$pname = 'phar://' . dirname(__FILE__) . '/files/nophar.phar';
var_dump(file_get_contents($pname . '/b/c.php'));
$a = opendir($pname);
while (false !== ($b = readdir($a))) {
var_dump($b);
}
foreach (new RecursiveIteratorIterator(new Phar($pname)) as $f) {
var_dump($f->getPathName());
}
var_dump(is_dir($pname . '/b'));
var_dump(is_dir($pname . '/d'));
var_dump(is_dir($pname . '/b/c.php'));
?>
===DONE===
--EXPECTF--
string(131) "<?php echo "in b\n";$a = fopen("index.php", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";"
unicode(1) "b"
unicode(1) "d"
unicode(9) "index.php"
unicode(7) "web.php"
string(%d) "phar://%snophar.phar/b%cc.php"
string(%d) "phar://%snophar.phar%cd"
string(%d) "phar://%snophar.phar%cindex.php"
string(%d) "phar://%snophar.phar%cweb.php"
bool(true)
bool(false)
bool(false)
===DONE===

View File

@ -1,12 +1,17 @@
--TEST--
Phar: test edge cases of file_get_contents() function interception
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
<?php
if (!extension_loaded("phar")) die("skip");
if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
?>
--INI--
phar.readonly=0
--FILE--
<?php
Phar::interceptFileFuncs();
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
@ -17,6 +22,7 @@ file_put_contents("foob", "test\n");
echo file_get_contents($fname);
unlink($fname);
mkdir($pname . '/oops');
file_put_contents($pname . '/foo/hi', '<?php
echo file_get_contents("foo/" . basename(__FILE__));
$context = stream_context_create();
@ -32,7 +38,9 @@ echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
');
include $pname . '/foo/hi';
?>
===DONE===
--CLEAN--
@ -92,4 +100,4 @@ ini_set(\"magic_quotes_runtime\", 1);
echo file_get_contents(\"./hi\");
echo file_get_contents(\"./hi\", 0, $context, 0, 0);
?>
===DONE===
===DONE===

View File

@ -4,7 +4,7 @@ ini_set('date.timezone', 'GMT');
$fname = dirname(__FILE__) . '/phar_oo_test.phar.php';
$pname = 'phar://' . $fname;
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();

View File

@ -5,7 +5,7 @@ if (function_exists('date_default_timezone_set')) {
}
$manifest = (binary)'';
$glags = 0;
$gflags = 0;
foreach($files as $name => $cont)
{

View File

@ -1,7 +1,7 @@
--TEST--
Phar: test edge cases of fopen() function interception #2
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
<?php if (!extension_loaded("phar")) die("skip"); ?>
--INI--
phar.readonly=0
--FILE--
@ -40,4 +40,4 @@ blah
test
Warning: fopen(phar://%sfopen_edgecases2.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfopen_edgecases2.phar.php/foo/hi on line %d
===DONE===
===DONE===

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with mounted external file
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -9,7 +9,7 @@ SCRIPT_NAME=/front.phar.php
REQUEST_URI=/front.phar.php/index.php
PATH_INFO=/index.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/blog.phar
--EXPECT--

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller rewrite access denied
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/hi
--FILE_EXTERNAL--
files/frontcontroller4.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
Status: 403 Access Denied
--EXPECT--
<html>

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type unknown int
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller6.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed' in %sfrontcontroller12.php:2
Stack trace:

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type not string/int
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller7.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed' in %sfrontcontroller13.php:2
Stack trace:

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type override, Phar::PHPS
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type override, Phar::PHP
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.phps
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
hio1

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller PHP test
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
hio

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller $_SERVER munging success
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -12,7 +12,7 @@ QUERY_STRING=test=hi
--FILE_EXTERNAL--
files/frontcontroller12.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(10) "/index.php"
string(10) "/index.php"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller include from cwd test 1
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/index.php
--FILE_EXTERNAL--
files/frontcontroller13.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(4) "test"
string(12) "oof/test.php"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with generic action router test
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/hi/there
--FILE_EXTERNAL--
files/frontcontroller14.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(9) "/hi/there"
string(%d) "phar://%sfrontcontroller23.php/html/index.php"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with custom 404 php script
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/unknown/file
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
My 404 is rawesome

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with extra path_info
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a1.phps/extra/stuff
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(42) "/frontcontroller25.php/a1.phps/extra/stuff"
string(12) "/extra/stuff"

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with no extension
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/noext
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/plain
Content-type: text/plain;charset=UTF-8
--EXPECTF--
hi

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with fatal error in php file
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/fatalerror.phps
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Call to undefined function oopsie_daisy() in phar://%sfatalerror.phps on line 1

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller phps
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.phps
--FILE_EXTERNAL--
files/frontcontroller.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View File

@ -1,14 +1,14 @@
--TEST--
Phar front controller with invalid callback for rewrites
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
SCRIPT_NAME=/frontcontroller31.php
REQUEST_URI=/frontcontroller31.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller16.phar
--EXPECT--

View File

@ -1,14 +1,14 @@
--TEST--
Phar front controller with valid callback that is not good
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
SCRIPT_NAME=/frontcontroller32.php
REQUEST_URI=/frontcontroller32.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller17.phar
--EXPECTF--

View File

@ -1,14 +1,14 @@
--TEST--
Phar front controller with valid callback that does not return any value
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
SCRIPT_NAME=/frontcontroller33.php
REQUEST_URI=/frontcontroller33.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller18.phar
--EXPECTF--

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller with cwd
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -9,7 +9,7 @@ SCRIPT_NAME=/frontcontroller34.php
REQUEST_URI=/frontcontroller34.php/start/index.php
PATH_INFO=/start/index.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller19.phar
--EXPECT--

View File

@ -1,7 +1,7 @@
--TEST--
Phar front controller rewrite array
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/hi
--FILE_EXTERNAL--
files/frontcontroller3.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View File

@ -1,7 +1,10 @@
--TEST--
Phar: test ini_set with readonly and require_hash enabled
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
<?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
phar.readonly=1

View File

@ -0,0 +1,31 @@
--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"

View File

@ -1,7 +1,10 @@
--TEST--
Phar: test ini_set with readonly and require_hash disabled
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
<?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
phar.readonly=0

View File

@ -0,0 +1,88 @@
--TEST--
Phar: test ini_set with readonly and require_hash disabled
--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
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'));
ini_set('phar.require_hash', 0);
ini_set('phar.readonly', 0);
var_dump(Phar::canWrite());
?>
yes
<?php
var_dump(ini_set('phar.require_hash', 'yes'));
var_dump(ini_set('phar.readonly', 'yes'));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
var_dump(Phar::canWrite());
ini_set('phar.require_hash', 0);
ini_set('phar.readonly', 0);
?>
on
<?php
var_dump(ini_set('phar.require_hash', 'on'));
var_dump(ini_set('phar.readonly', 'on'));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
var_dump(Phar::canWrite());
ini_set('phar.require_hash', 0);
ini_set('phar.readonly', 0);
?>
true
<?php
var_dump(ini_set('phar.require_hash', 'true'));
var_dump(ini_set('phar.readonly', 'true'));
var_dump(Phar::canWrite());
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
?>
0
<?php
var_dump(ini_set('phar.require_hash', 0));
var_dump(ini_set('phar.readonly', 0));
var_dump(Phar::canWrite());
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
?>
===DONE===
--EXPECT--
unicode(1) "0"
unicode(1) "0"
unicode(1) "1"
unicode(1) "1"
bool(true)
yes
unicode(1) "0"
unicode(1) "0"
unicode(3) "yes"
unicode(3) "yes"
bool(false)
on
unicode(1) "0"
unicode(1) "0"
unicode(2) "on"
unicode(2) "on"
bool(false)
true
unicode(1) "0"
unicode(1) "0"
bool(false)
unicode(4) "true"
unicode(4) "true"
0
unicode(4) "true"
unicode(4) "true"
bool(true)
unicode(1) "0"
unicode(1) "0"
===DONE===

View File

@ -1,7 +1,10 @@
--TEST--
Phar with meta-data (read)
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
<?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
--FILE--

View File

@ -0,0 +1,64 @@
--TEST--
Phar with meta-data (read)
--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
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
$files['b'] = array('cont' => 'b', 'meta' => 'hi there');
$files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
NULL
unicode(8) "hi there"
array(2) {
[0]=>
unicode(2) "hi"
[1]=>
unicode(5) "there"
}
array(2) {
[u"hi"]=>
unicode(5) "there"
[u"foo"]=>
unicode(3) "bar"
}
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
===DONE===

View File

@ -1,7 +1,10 @@
--TEST--
Phar with meta-data (write)
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
<?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
phar.readonly=0

View File

@ -0,0 +1,65 @@
--TEST--
Phar with meta-data (write)
--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
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
$files['b'] = array('cont' => 'b', 'meta' => 'hi there');
$files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
$phar['a']->setMetadata(42);
$phar['b']->setMetadata(NULL);
$phar['c']->setMetadata(array(25, 'foo'=>'bar'));
$phar['d']->setMetadata(true);
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
int(42)
NULL
array(2) {
[0]=>
int(25)
[u"foo"]=>
unicode(3) "bar"
}
bool(true)
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
===DONE===

View File

@ -1,7 +1,10 @@
--TEST--
Phar with meta-data (write)
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip");?>
<?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
phar.readonly=0

View File

@ -0,0 +1,82 @@
--TEST--
Phar with meta-data (write)
--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
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
$files['b'] = array('cont' => 'b', 'meta' => 'hi there');
$files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
$phar->startBuffering();
$phar['a']->setMetadata(42);
$phar['b']->setMetadata(NULL);
$phar['c']->setMetadata(array(25, 'foo'=>'bar'));
$phar['d']->setMetadata(true);
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
$phar->stopBuffering();
unset($phar);
$phar = new Phar($fname);
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
int(42)
NULL
array(2) {
[0]=>
int(25)
[u"foo"]=>
unicode(3) "bar"
}
bool(true)
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
int(42)
NULL
array(2) {
[0]=>
int(25)
[u"foo"]=>
unicode(3) "bar"
}
bool(true)
===DONE===

View File

@ -1,7 +1,10 @@
--TEST--
Phar: mounted manifest directory test
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php
if (!extension_loaded("phar")) die("skip");
if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
?>
--INI--
phar.readonly=0
--FILE--
@ -105,11 +108,11 @@ Mounting of .phar/stub.php to %sextfile.php within phar %stests/tempmanifest1.ph
directory
extfile.php
extfile2.php
phar://%stempmanifest1.phar.php/testit/directory
phar://%stempmanifest1.phar.php/testit/extfile.php
phar://%stempmanifest1.phar.php/testit/extfile2.php
phar://%stempmanifest1.phar.php/testit%cdirectory
phar://%stempmanifest1.phar.php/testit%cextfile.php
phar://%stempmanifest1.phar.php/testit%cextfile2.php
Mounting of /testit to another\..\mistake within phar %stempmanifest1.phar.php failed
Mounting of /notfound to %stests/this/does/not/exist within phar %stempmanifest1.phar.php failed
Mounting of /testit to %stests within phar %stests/tempmanifest1.phar.php failed
Mounting of /testit/extfile.php to %stests within phar %stests/tempmanifest1.phar.php failed
===DONE===
===DONE===

View File

@ -0,0 +1,118 @@
--TEST--
Phar: mounted manifest directory test
--SKIPIF--
<?php
if (!extension_loaded("phar")) die("skip");
if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support required");
?>
--INI--
phar.readonly=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/tempmanifest1.phar.php';
$pname = 'phar://' . $fname;
$a = new Phar($fname);
$a['index.php'] = '<?php
Phar::mount("testit", dirname(Phar::running(0)) . "/testit");
echo file_get_contents(Phar::running(1) . "/testit/extfile.php"), "\n";
echo file_get_contents(Phar::running(1) . "/testit/directory"), "\n";
echo file_get_contents(Phar::running(1) . "/testit/existing.txt"), "\n";
include "testit/extfile.php";
include "testit/extfile2.php";
try {
Phar::mount(".phar/stub.php", dirname(Phar::running(0)) . "/testit/extfile.php");
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
?>';
$a['testit/existing.txt'] = 'oops';
$a->setStub('<?php
set_include_path("phar://" . __FILE__);
include "index.php";
__HALT_COMPILER();');
unset($a);
mkdir(dirname(__FILE__) . '/testit');
mkdir(dirname(__FILE__) . '/testit/directory');
file_put_contents(dirname(__FILE__) . '/testit/extfile.php', '<?php
var_dump(__FILE__);
?>');
file_put_contents(dirname(__FILE__) . '/testit/extfile2.php', '<?php
var_dump(__FILE__);
?>');
include dirname(__FILE__) . '/testit/extfile.php';
include $fname;
$a = opendir($pname . '/testit');
$out = array();
while (false !== ($b = readdir($a))) {
$out[] = $b;
}
sort($out);
foreach ($out as $b) {
echo "$b\n";
}
$out = array();
foreach (new Phar($pname . '/testit') as $b) {
$out[] = $b->getPathName();
}
sort($out);
foreach ($out as $b) {
echo "$b\n";
}
try {
Phar::mount($pname . '/testit', 'another\\..\\mistake');
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
Phar::mount($pname . '/notfound', dirname(__FILE__) . '/this/does/not/exist');
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
Phar::mount($pname . '/testit', dirname(__FILE__));
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
Phar::mount($pname . '/testit/extfile.php', dirname(__FILE__));
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
===DONE===
--CLEAN--
<?php
@unlink(dirname(__FILE__) . '/tempmanifest1.phar.php');
@unlink(dirname(__FILE__) . '/testit/extfile.php');
@unlink(dirname(__FILE__) . '/testit/extfile2.php');
@rmdir(dirname(__FILE__) . '/testit/directory');
@rmdir(dirname(__FILE__) . '/testit');
?>
--EXPECTF--
unicode(%d) "%sextfile.php"
<?php
var_dump(__FILE__);
?>
Warning: file_get_contents(phar://%stempmanifest1.phar.php/testit/directory): failed to open stream: phar error: path "testit/directory" is a directory in phar://%stempmanifest1.phar.php/index.php on line %d
oops
unicode(%d) "phar://%sextfile.php"
unicode(%d) "phar://%sextfile2.php"
Mounting of .phar/stub.php to %sextfile.php within phar %stests/tempmanifest1.phar.php failed
.
..
directory
extfile.php
extfile2.php
phar://%stempmanifest1.phar.php/testit%cdirectory
phar://%stempmanifest1.phar.php/testit%cextfile.php
phar://%stempmanifest1.phar.php/testit%cextfile2.php
Mounting of /testit to another\..\mistake within phar %stempmanifest1.phar.php failed
Mounting of /notfound to %stests/this/does/not/exist within phar %stempmanifest1.phar.php failed
Mounting of /testit to %stests within phar %stests/tempmanifest1.phar.php failed
Mounting of /testit/extfile.php to %stests within phar %stests/tempmanifest1.phar.php failed
===DONE===

View File

@ -18,7 +18,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, b'extra');
fclose($fp);
include $pname . '/b/c.php';
?>

View File

@ -34,10 +34,10 @@ include $pname . '/b/c.php';
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_b.phar.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_5_2.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b_5_2.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 %spen_for_write_existing_b_5_2.php on line %d
Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d
Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b_5_2.php on line %d
This is b/c
===DONE===
===DONE===

View File

@ -28,10 +28,10 @@ include $pname . '/b/c.php';
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_c.phar.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_5_2.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c_5_2.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: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c_5_2.php on line %d
Warning: fclose(): 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_5_2.php on line %d
This is b/c
===DONE===
===DONE===

View File

@ -18,7 +18,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, b'extra');
fclose($fp);
include $pname . '/b/c.php';
include $pname . '/b/new.php';

View File

@ -36,15 +36,15 @@ include $pname . '/b/new.php';
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_b.phar.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_5_2.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b_5_2.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: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b_5_2.php on line %d
Warning: fclose(): 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_5_2.php on line %d
This is b/c
Warning: include(phar://%sopen_for_write_newfile_b.phar.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.php" in %sopen_for_write_newfile_b.php on line %d
Warning: include(phar://%sopen_for_write_newfile_b_5_2.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b_5_2.phar.php" in %sopen_for_write_newfile_b_5_2.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.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_5_2.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b_5_2.php on line %d
===DONE===

View File

@ -30,15 +30,15 @@ include $pname . '/b/new.php';
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_c.phar.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_5_2.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c_5_2.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: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c_5_2.php on line %d
Warning: fclose(): 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_5_2.php on line %d
This is b/c
Warning: include(phar://%sopen_for_write_newfile_c.phar.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.php" in %sopen_for_write_newfile_c.php on line %d
Warning: include(phar://%sopen_for_write_newfile_c_5_2.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c_5_2.phar.php" in %sopen_for_write_newfile_c_5_2.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.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_5_2.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c_5_2.php on line %d
===DONE===
===DONE===

View File

@ -11,8 +11,10 @@ $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$a = new Phar($fname);
$a['index.php'] = '<?php
$a = opendir("dir");
while (false !== ($e = readdir($a))) {
echo $e;
if ($a) {
while (false !== ($e = readdir($a))) {
echo $e;
}
}
?>';
$a['dir/file1.txt'] = 'hi';

View File

@ -6,17 +6,25 @@ Phar: test edge cases of opendir() function interception
phar.readonly=0
--FILE--
<?php
Phar::interceptFileFuncs();
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
opendir(array());
mkdir(dirname(__FILE__) . '/poo');
chdir(dirname(__FILE__));
$a = opendir('poo');
while (false !== ($b = readdir($a))) {
echo "$b\n";
echo "$b\n";
}
closedir($a);
file_put_contents($pname . '/foo', '<?php
$context = stream_context_create();
$a = opendir(".", $context);
@ -30,14 +38,16 @@ echo "$b\n";
}
opendir("oops");
?>');
include $pname . '/foo';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(dirname(__FILE__) . '/poo');
--EXPECTF--
Warning: opendir() expects parameter 1 to be string, array given in %sopendir_edgecases.php on line %d
Warning: opendir() expects parameter 1 to be %string, array given in %sopendir_edgecases.php on line %d
.
..
foo

View File

@ -1,7 +1,10 @@
--TEST--
Phar::startBuffering()/setStub()/stopBuffering()
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?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
phar.readonly=0

View File

@ -0,0 +1,53 @@
--TEST--
Phar::startBuffering()/setStub()/stopBuffering()
--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
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
//var_dump($p->getStub());
var_dump($p->isBuffering());
$p->startBuffering();
var_dump($p->isBuffering());
$p['a.php'] = '<?php var_dump("Hello");';
$p->setStub('<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>');
include 'phar://brandnewphar.phar/a.php';
var_dump($p->getStub());
$p['b.php'] = '<?php var_dump("World");';
$p->setStub('<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER();');
include 'phar://brandnewphar.phar/b.php';
var_dump($p->getStub());
$p->stopBuffering();
echo "===COMMIT===\n";
var_dump($p->isBuffering());
include 'phar://brandnewphar.phar/a.php';
include 'phar://brandnewphar.phar/b.php';
var_dump($p->getStub());
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
--EXPECT--
bool(true)
bool(false)
unicode(5) "Hello"
string(84) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
unicode(5) "World"
string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
===COMMIT===
bool(true)
unicode(5) "Hello"
unicode(5) "World"
string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
===DONE===

View File

@ -22,7 +22,7 @@ try {
unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
__HALT_COMPILER();
?>
--EXPECT--
string(24) "UnexpectedValueException"
--EXPECTF--
%s(24) "UnexpectedValueException"
Cannot write to archive - write operations restricted by INI setting
===DONE===

View File

@ -21,7 +21,7 @@ try {
unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
__HALT_COMPILER();
?>
--EXPECT--
string(24) "UnexpectedValueException"
--EXPECTF--
%s(24) "UnexpectedValueException"
RecursiveDirectoryIterator::__construct(1): failed to open dir: No such file or directory
===DONE===

View File

@ -23,5 +23,5 @@ unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER();
?>
--EXPECTF--
Warning: Phar::buildFromDirectory() expects parameter 2 to be string, object given in %sphar_buildfromdirectory3.php on line %d
Warning: Phar::buildFromDirectory() expects parameter 2 to be %string, object given in %sphar_buildfromdirectory3.php on line %d
===DONE===

View File

@ -22,7 +22,7 @@ try {
unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER();
?>
--EXPECT--
string(24) "UnexpectedValueException"
--EXPECTF--
%s(24) "UnexpectedValueException"
Cannot write out phar archive, phar is read-only
===DONE===

View File

@ -1,7 +1,10 @@
--TEST--
Phar::buildFromIterator() RegexIterator(RecursiveIteratorIterator), SplFileInfo as current
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?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
phar.readonly=0

View File

@ -0,0 +1,101 @@
--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===

View File

@ -50,5 +50,5 @@ unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER();
?>
--EXPECTF--
Warning: Phar::buildFromIterator() expects parameter 2 to be string, object given in %sphar_buildfromiterator3.php on line %d
Warning: Phar::buildFromIterator() expects parameter 2 to be %string, object given in %sphar_buildfromiterator3.php on line %d
===DONE===

View File

@ -54,6 +54,6 @@ __HALT_COMPILER();
rewind
valid
current
string(24) "UnexpectedValueException"
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid value (must return a string)
===DONE===

View File

@ -55,6 +55,6 @@ rewind
valid
current
key
string(24) "UnexpectedValueException"
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid key (must return a string)
===DONE===

View File

@ -50,11 +50,11 @@ try {
unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER();
?>
--EXPECT--
--EXPECTF--
rewind
valid
current
key
string(24) "UnexpectedValueException"
%s(24) "UnexpectedValueException"
Iterator myIterator returned a file that could not be opened "phar_buildfromiterator7./oopsie/there.phpt"
===DONE===

Some files were not shown because too many files have changed in this diff Show More