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

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