File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_linkinfo.phpt
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 20:04:03 2014 UTC (10 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29, HEAD
php 5.4.29

    1: --TEST--
    2: Test open_basedir configuration
    3: --SKIPIF--
    4: <?php
    5: if (substr(PHP_OS, 0, 3) == 'WIN') {
    6:     die('skip no symlinks on Windows');
    7: }
    8: ?>
    9: --XFAIL--
   10: BUG: open_basedir cannot delete symlink to prohibited file. See also
   11: bugs 48111 and 52176.
   12: --FILE--
   13: <?php
   14: chdir(__DIR__);
   15: ini_set("open_basedir", ".");
   16: require_once "open_basedir.inc";
   17: $initdir = getcwd();
   18: test_open_basedir_before("linkinfo", FALSE);
   19: 
   20: chdir($initdir);
   21: 
   22: $target = ($initdir."/test/bad/bad.txt");
   23: $symlink = ($initdir."/test/ok/symlink.txt");
   24: var_dump(symlink($target, $symlink));
   25: 
   26: chdir($initdir."/test/ok");
   27: 
   28: var_dump(linkinfo("symlink.txt"));
   29: var_dump(linkinfo("../ok/symlink.txt"));
   30: var_dump(linkinfo("../ok/./symlink.txt"));
   31: var_dump(linkinfo("./symlink.txt"));
   32: var_dump(linkinfo($initdir."/test/ok/symlink.txt"));
   33: 
   34: $target = ($initdir."/test/ok/ok.txt");
   35: $symlink = ($initdir."/test/ok/symlink.txt");
   36: var_dump(symlink($target, $symlink));
   37: var_dump(linkinfo($symlink));
   38: var_dump(unlink($symlink));
   39: 
   40: test_open_basedir_after("linkinfo");
   41: ?>
   42: --CLEAN--
   43: <?php
   44: chdir(__DIR__);
   45: require_once "open_basedir.inc";
   46: delete_directories();
   47: ?>
   48: --EXPECTF--
   49: *** Testing open_basedir configuration [linkinfo] ***
   50: bool(true)
   51: bool(true)
   52: bool(true)
   53: bool(true)
   54: bool(true)
   55: int(%d)
   56: int(%d)
   57: int(%d)
   58: int(%d)
   59: int(%d)
   60: 
   61: 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
   62: bool(false)
   63: int(%d)
   64: bool(true)
   65: *** Finished testing open_basedir configuration [linkinfo] ***
   66: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>