2008-04-23 14:10:15 +00:00
|
|
|
--TEST--
|
|
|
|
Test open_basedir configuration
|
|
|
|
--SKIPIF--
|
|
|
|
<?php
|
|
|
|
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
|
|
|
die('skip no symlinks on Windows');
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2011-08-31 04:24:48 +00:00
|
|
|
chdir(__DIR__);
|
|
|
|
ini_set("open_basedir", ".");
|
2008-04-23 14:10:15 +00:00
|
|
|
require_once "open_basedir.inc";
|
2009-01-22 07:56:56 +00:00
|
|
|
$initdir = getcwd();
|
2008-04-23 14:10:15 +00:00
|
|
|
test_open_basedir_before("readlink", FALSE);
|
|
|
|
|
2009-01-22 07:56:56 +00:00
|
|
|
chdir($initdir);
|
2008-04-23 14:10:15 +00:00
|
|
|
|
2009-01-22 07:56:56 +00:00
|
|
|
$target = ($initdir."/test/bad/bad.txt");
|
|
|
|
$symlink = ($initdir."/test/ok/symlink.txt");
|
2008-04-23 14:10:15 +00:00
|
|
|
var_dump(symlink($target, $symlink));
|
|
|
|
|
2009-01-22 07:56:56 +00:00
|
|
|
chdir($initdir."/test/ok");
|
2008-04-23 14:10:15 +00:00
|
|
|
|
|
|
|
var_dump(readlink("symlink.txt"));
|
|
|
|
var_dump(readlink("../ok/symlink.txt"));
|
|
|
|
var_dump(readlink("../ok/./symlink.txt"));
|
|
|
|
var_dump(readlink("./symlink.txt"));
|
2009-01-22 07:56:56 +00:00
|
|
|
var_dump(readlink($initdir."/test/ok/symlink.txt"));
|
2008-04-23 14:10:15 +00:00
|
|
|
|
2009-01-22 07:56:56 +00:00
|
|
|
$target = ($initdir."/test/ok/ok.txt");
|
|
|
|
$symlink = ($initdir."/test/ok/symlink.txt");
|
2008-04-23 14:10:15 +00:00
|
|
|
var_dump(symlink($target, $symlink));
|
|
|
|
var_dump(readlink($symlink));
|
|
|
|
|
|
|
|
test_open_basedir_after("readlink");
|
|
|
|
?>
|
|
|
|
--CLEAN--
|
|
|
|
<?php
|
2014-01-20 17:04:35 +00:00
|
|
|
chdir(__DIR__);
|
2008-04-23 14:10:15 +00:00
|
|
|
require_once "open_basedir.inc";
|
|
|
|
delete_directories();
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
*** Testing open_basedir configuration [readlink] ***
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
|
|
|
|
Warning: readlink(): open_basedir restriction in effect. File(symlink.txt) is not within the allowed path(s): (.) in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
|
|
|
|
Warning: readlink(): open_basedir restriction in effect. File(../ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
|
|
|
|
Warning: readlink(): open_basedir restriction in effect. File(../ok/./symlink.txt) is not within the allowed path(s): (.) in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
|
|
|
|
Warning: readlink(): open_basedir restriction in effect. File(./symlink.txt) is not within the allowed path(s): (.) in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
|
|
|
|
Warning: readlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
|
|
|
|
Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
|
|
|
|
Warning: readlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
*** Finished testing open_basedir configuration [readlink] ***
|
|
|
|
|