1--TEST-- 2Test open_basedir configuration 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip no symlinks on Windows'); 7} 8?> 9--INI-- 10open_basedir=. 11--FILE-- 12<?php 13require_once "open_basedir.inc"; 14$initdir = getcwd(); 15test_open_basedir_before("linkinfo", FALSE); 16 17chdir($initdir); 18 19$target = ($initdir."/test/bad/bad.txt"); 20$symlink = ($initdir."/test/ok/symlink.txt"); 21var_dump(symlink($target, $symlink)); 22 23chdir($initdir."/test/ok"); 24 25var_dump(linkinfo("symlink.txt")); 26var_dump(linkinfo("../ok/symlink.txt")); 27var_dump(linkinfo("../ok/./symlink.txt")); 28var_dump(linkinfo("./symlink.txt")); 29var_dump(linkinfo($initdir."/test/ok/symlink.txt")); 30 31$target = ($initdir."/test/ok/ok.txt"); 32$symlink = ($initdir."/test/ok/symlink.txt"); 33var_dump(symlink($target, $symlink)); 34var_dump(linkinfo($symlink)); 35var_dump(unlink($symlink)); 36 37test_open_basedir_after("linkinfo"); 38?> 39--CLEAN-- 40<?php 41require_once "open_basedir.inc"; 42delete_directories(); 43?> 44--EXPECTF-- 45*** Testing open_basedir configuration [linkinfo] *** 46bool(true) 47bool(true) 48bool(true) 49bool(true) 50bool(true) 51int(%d) 52int(%d) 53int(%d) 54int(%d) 55int(%d) 56 57Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d 58bool(false) 59int(%d) 60 61Warning: unlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d 62bool(false) 63*** Finished testing open_basedir configuration [linkinfo] *** 64 65