File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_opendir.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("opendir");
   10: test_open_basedir_error("opendir");     
   11: 
   12: var_dump(opendir($initdir."/test/ok/"));
   13: var_dump(opendir($initdir."/test/ok"));
   14: var_dump(opendir($initdir."/test/ok/../ok"));
   15: 
   16: test_open_basedir_after("opendir");?>
   17: --CLEAN--
   18: <?php
   19: require_once "open_basedir.inc";
   20: delete_directories();
   21: ?>
   22: --EXPECTF--
   23: *** Testing open_basedir configuration [opendir] ***
   24: bool(true)
   25: bool(true)
   26: bool(true)
   27: bool(true)
   28: bool(true)
   29: 
   30: Warning: opendir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
   31: 
   32: Warning: opendir(../bad): failed to open dir: %s in %s on line %d
   33: bool(false)
   34: 
   35: Warning: opendir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   36: 
   37: Warning: opendir(../bad/bad.txt): failed to open dir: %s in %s on line %d
   38: bool(false)
   39: 
   40: Warning: opendir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
   41: 
   42: Warning: opendir(..): failed to open dir: %s in %s on line %d
   43: bool(false)
   44: 
   45: Warning: opendir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
   46: 
   47: Warning: opendir(../): failed to open dir: %s in %s on line %d
   48: bool(false)
   49: 
   50: Warning: opendir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
   51: 
   52: Warning: opendir(/): failed to open dir: %s in %s on line %d
   53: bool(false)
   54: 
   55: Warning: opendir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
   56: 
   57: Warning: opendir(../bad/.): failed to open dir: %s in %s on line %d
   58: bool(false)
   59: 
   60: Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   61: 
   62: Warning: opendir(%s/test/bad/bad.txt): failed to open dir: %s in %s on line %d
   63: bool(false)
   64: 
   65: Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   66: 
   67: Warning: opendir(%s/test/bad/../bad/bad.txt): failed to open dir: %s in %s on line %d
   68: bool(false)
   69: resource(%d) of type (stream)
   70: resource(%d) of type (stream)
   71: resource(%d) of type (stream)
   72: *** Finished testing open_basedir configuration [opendir] ***
   73: 

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