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