File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_is_executable.phpt
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 4 months ago) by misho
CVS tags: MAIN, HEAD
Initial revision

    1: --TEST--
    2: Test open_basedir configuration
    3: --INI--
    4: open_basedir=.
    5: --FILE--
    6: <?php
    7: require_once "open_basedir.inc";
    8: $initdir = getcwd();
    9: test_open_basedir_before("is_executable");
   10: test_open_basedir_error("is_executable");     
   11: 
   12: var_dump(is_executable("ok.txt"));
   13: var_dump(is_executable("../ok/ok.txt"));
   14: var_dump(is_executable($initdir."/test/ok/ok.txt"));
   15: var_dump(is_executable($initdir."/test/ok/../ok/ok.txt"));
   16: 
   17: test_open_basedir_after("is_executable");
   18: ?>
   19: --CLEAN--
   20: <?php
   21: require_once "open_basedir.inc";
   22: delete_directories();
   23: ?>
   24: --EXPECTF--
   25: *** Testing open_basedir configuration [is_executable] ***
   26: bool(true)
   27: bool(true)
   28: bool(true)
   29: bool(true)
   30: bool(true)
   31: 
   32: Warning: is_executable(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
   33: bool(false)
   34: 
   35: Warning: is_executable(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   36: bool(false)
   37: 
   38: Warning: is_executable(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
   39: bool(false)
   40: 
   41: Warning: is_executable(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
   42: bool(false)
   43: 
   44: Warning: is_executable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
   45: bool(false)
   46: 
   47: Warning: is_executable(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
   48: bool(false)
   49: 
   50: Warning: is_executable(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   51: bool(false)
   52: 
   53: Warning: is_executable(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   54: bool(false)
   55: bool(false)
   56: bool(false)
   57: bool(false)
   58: bool(false)
   59: *** Finished testing open_basedir configuration [is_executable] ***

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