File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_dir.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    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: 
   10: test_open_basedir_before("dir");
   11: test_open_basedir_error("dir");     
   12: 
   13: var_dump(dir($initdir."/test/ok/"));
   14: var_dump(dir($initdir."/test/ok"));
   15: var_dump(dir($initdir."/test/ok/../ok"));
   16: 
   17: test_open_basedir_after("dir");?>
   18: --CLEAN--
   19: <?php
   20: require_once "open_basedir.inc";
   21: delete_directories();
   22: ?>
   23: --EXPECTF--
   24: *** Testing open_basedir configuration [dir] ***
   25: bool(true)
   26: bool(true)
   27: bool(true)
   28: bool(true)
   29: bool(true)
   30: 
   31: Warning: dir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
   32: 
   33: Warning: dir(../bad): failed to open dir: %s in %s on line %d
   34: bool(false)
   35: 
   36: Warning: dir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   37: 
   38: Warning: dir(../bad/bad.txt): failed to open dir: %s in %s on line %d
   39: bool(false)
   40: 
   41: Warning: dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
   42: 
   43: Warning: dir(..): failed to open dir: %s in %s on line %d
   44: bool(false)
   45: 
   46: Warning: dir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
   47: 
   48: Warning: dir(../): failed to open dir: %s in %s on line %d
   49: bool(false)
   50: 
   51: Warning: dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
   52: 
   53: Warning: dir(/): failed to open dir: %s in %s on line %d
   54: bool(false)
   55: 
   56: Warning: dir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
   57: 
   58: Warning: dir(../bad/.): failed to open dir: %s in %s on line %d
   59: bool(false)
   60: 
   61: Warning: dir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   62: 
   63: Warning: dir(%s/test/bad/bad.txt): failed to open dir: %s in %s on line %d
   64: bool(false)
   65: 
   66: Warning: dir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   67: 
   68: Warning: dir(%s/test/bad/../bad/bad.txt): failed to open dir: %s in %s on line %d
   69: bool(false)
   70: object(Directory)#%d (2) {
   71:   ["path"]=>
   72:   string(%d) "%s/test/ok/"
   73:   ["handle"]=>
   74:   resource(%d) of type (stream)
   75: }
   76: object(Directory)#%d (2) {
   77:   ["path"]=>
   78:   string(%d) "%s/test/ok"
   79:   ["handle"]=>
   80:   resource(%d) of type (stream)
   81: }
   82: object(Directory)#%d (2) {
   83:   ["path"]=>
   84:   string(%d) "%s/test/ok/../ok"
   85:   ["handle"]=>
   86:   resource(%d) of type (stream)
   87: }
   88: *** Finished testing open_basedir configuration [dir] ***
   89: 

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