1--TEST-- 2symlink() & friends 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip no symlinks on Windows'); 7} 8?> 9--FILE-- 10<?php 11 12$filename = dirname(__FILE__)."/symlink.dat"; 13$link = dirname(__FILE__)."/symlink.link"; 14 15var_dump(symlink($filename, $link)); 16var_dump(readlink($link)); 17var_dump(linkinfo($link)); 18@unlink($link); 19 20var_dump(readlink($link)); 21var_dump(linkinfo($link)); 22 23touch($filename); 24var_dump(symlink($filename, dirname(__FILE__))); 25@unlink($link); 26 27var_dump(symlink($filename, $link)); 28@unlink($link); 29 30touch($link); 31var_dump(symlink($filename, $link)); 32@unlink($link); 33 34var_dump(link($filename, $link)); 35@unlink($filename); 36 37var_dump(link($filename, $link)); 38@unlink($link); 39 40var_dump(symlink(".", ".")); 41var_dump(link(".", ".")); 42var_dump(readlink(".")); 43var_dump(linkinfo(".")); 44 45echo "Done\n"; 46?> 47--EXPECTF-- 48bool(true) 49string(%d) "%ssymlink.dat" 50int(%d) 51 52Warning: readlink(): No such file or directory in %s on line %d 53bool(false) 54 55Warning: linkinfo(): No such file or directory in %s on line %d 56int(-1) 57 58Warning: symlink(): File exists in %s on line %d 59bool(false) 60bool(true) 61 62Warning: symlink(): File exists in %s on line %d 63bool(false) 64bool(true) 65 66Warning: link(): No such file or directory in %s on line %d 67bool(false) 68 69Warning: symlink(): %s in %s on line %d 70bool(false) 71 72Warning: link(): %s in %s on line %d 73bool(false) 74 75Warning: readlink(): Invalid argument in %s on line %d 76bool(false) 77int(%d) 78Done 79