2008-05-12 21:03:49 +00:00
|
|
|
--TEST--
|
|
|
|
Phar: ignore filenames starting with / on offsetSet
|
|
|
|
--SKIPIF--
|
|
|
|
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
|
|
|
<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
|
|
|
|
--INI--
|
|
|
|
phar.readonly=0
|
|
|
|
phar.require_hash=1
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
|
|
|
$pname = 'phar://'.$fname;
|
|
|
|
$iname = '/file.txt';
|
|
|
|
$ename = '/error/..';
|
|
|
|
|
|
|
|
$p = new Phar($fname);
|
|
|
|
$p[$iname] = "foobar\n";
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$p[$ename] = "foobar\n";
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
echo $e->getMessage() . "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
include($pname . $iname);
|
2008-05-15 16:09:01 +00:00
|
|
|
|
|
|
|
// extra coverage
|
|
|
|
try {
|
|
|
|
$p['.phar/oops'] = 'hi';
|
|
|
|
} catch (Exception $e) {
|
|
|
|
echo $e->getMessage(),"\n";
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$a = $p['.phar/stub.php'];
|
|
|
|
} catch (Exception $e) {
|
|
|
|
echo $e->getMessage(),"\n";
|
|
|
|
}
|
2008-05-12 21:03:49 +00:00
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--CLEAN--
|
|
|
|
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
|
|
|
--EXPECT--
|
|
|
|
Entry /error/.. does not exist and cannot be created: phar error: invalid path "/error/.." contains upper directory reference
|
|
|
|
foobar
|
2008-05-15 16:09:01 +00:00
|
|
|
Cannot set any files or directories in magic ".phar" directory
|
|
|
|
Entry .phar/stub.php does not exist
|
2008-05-12 21:03:49 +00:00
|
|
|
===DONE===
|