File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_scandir.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: test_open_basedir_before("scandir");
   10: test_open_basedir_error("scandir");     
   11: 
   12: var_dump(scandir($initdir."/test/ok/"));
   13: var_dump(scandir($initdir."/test/ok"));
   14: var_dump(scandir($initdir."/test/ok/../ok"));
   15: 
   16: test_open_basedir_after("scandir");?>
   17: --CLEAN--
   18: <?php
   19: require_once "open_basedir.inc";
   20: delete_directories();
   21: ?>
   22: --EXPECTF--
   23: *** Testing open_basedir configuration [scandir] ***
   24: bool(true)
   25: bool(true)
   26: bool(true)
   27: bool(true)
   28: bool(true)
   29: 
   30: Warning: scandir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
   31: 
   32: Warning: scandir(../bad): failed to open dir: %s in %s on line %d
   33: 
   34: Warning: scandir(): (errno 1): %s in %s on line %d
   35: bool(false)
   36: 
   37: Warning: scandir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   38: 
   39: Warning: scandir(../bad/bad.txt): failed to open dir: %s in %s on line %d
   40: 
   41: Warning: scandir(): (errno 1): %s in %s on line %d
   42: bool(false)
   43: 
   44: Warning: scandir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
   45: 
   46: Warning: scandir(..): failed to open dir: %s in %s on line %d
   47: 
   48: Warning: scandir(): (errno 1): %s in %s on line %d
   49: bool(false)
   50: 
   51: Warning: scandir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
   52: 
   53: Warning: scandir(../): failed to open dir: %s in %s on line %d
   54: 
   55: Warning: scandir(): (errno 1): %s in %s on line %d
   56: bool(false)
   57: 
   58: Warning: scandir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
   59: 
   60: Warning: scandir(/): failed to open dir: %s in %s on line %d
   61: 
   62: Warning: scandir(): (errno 1): %s in %s on line %d
   63: bool(false)
   64: 
   65: Warning: scandir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
   66: 
   67: Warning: scandir(../bad/.): failed to open dir: %s in %s on line %d
   68: 
   69: Warning: scandir(): (errno 1): %s in %s on line %d
   70: bool(false)
   71: 
   72: Warning: scandir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   73: 
   74: Warning: scandir(%s/test/bad/bad.txt): failed to open dir: %s in %s on line %d
   75: 
   76: Warning: scandir(): (errno 1): %s in %s on line %d
   77: bool(false)
   78: 
   79: Warning: scandir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   80: 
   81: Warning: scandir(%s/test/bad/../bad/bad.txt): failed to open dir: %s in %s on line %d
   82: 
   83: Warning: scandir(): (errno 1): %s in %s on line %d
   84: bool(false)
   85: array(3) {
   86:   [0]=>
   87:   string(1) "."
   88:   [1]=>
   89:   string(2) ".."
   90:   [2]=>
   91:   string(6) "ok.txt"
   92: }
   93: array(3) {
   94:   [0]=>
   95:   string(1) "."
   96:   [1]=>
   97:   string(2) ".."
   98:   [2]=>
   99:   string(6) "ok.txt"
  100: }
  101: array(3) {
  102:   [0]=>
  103:   string(1) "."
  104:   [1]=>
  105:   string(2) ".."
  106:   [2]=>
  107:   string(6) "ok.txt"
  108: }
  109: *** Finished testing open_basedir configuration [scandir] ***
  110: 

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