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--XFAIL-- 10BUG: open_basedir cannot delete symlink to prohibited file. See also 11bugs 48111 and 52176. 12--FILE-- 13<?php 14chdir(__DIR__); 15ini_set("open_basedir", "."); 16require_once "open_basedir.inc"; 17$initdir = getcwd(); 18test_open_basedir_before("linkinfo", FALSE); 19 20chdir($initdir); 21 22$target = ($initdir."/test/bad/bad.txt"); 23$symlink = ($initdir."/test/ok/symlink.txt"); 24var_dump(symlink($target, $symlink)); 25 26chdir($initdir."/test/ok"); 27 28var_dump(linkinfo("symlink.txt")); 29var_dump(linkinfo("../ok/symlink.txt")); 30var_dump(linkinfo("../ok/./symlink.txt")); 31var_dump(linkinfo("./symlink.txt")); 32var_dump(linkinfo($initdir."/test/ok/symlink.txt")); 33 34$target = ($initdir."/test/ok/ok.txt"); 35$symlink = ($initdir."/test/ok/symlink.txt"); 36var_dump(symlink($target, $symlink)); 37var_dump(linkinfo($symlink)); 38var_dump(unlink($symlink)); 39 40test_open_basedir_after("linkinfo"); 41?> 42--CLEAN-- 43<?php 44chdir(__DIR__); 45require_once "open_basedir.inc"; 46delete_directories(); 47?> 48--EXPECTF-- 49*** Testing open_basedir configuration [linkinfo] *** 50bool(true) 51bool(true) 52bool(true) 53bool(true) 54bool(true) 55int(%d) 56int(%d) 57int(%d) 58int(%d) 59int(%d) 60 61Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d 62bool(false) 63int(%d) 64bool(true) 65*** Finished testing open_basedir configuration [linkinfo] *** 66 67