1--TEST-- 2Test readlink() and realpath() functions: error conditions 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip not for Windows'); 7} 8?> 9--FILE-- 10<?php 11echo "\n*** Testing readlink() on a non-existent link ***\n"; 12var_dump( readlink(__DIR__."/readlink_error.tmp") ); 13 14echo "\n*** Testing readlink() on existing file ***\n"; 15var_dump( readlink(__FILE__) ); 16 17echo "\n*** Testing readlink() on existing directory ***\n"; 18var_dump( readlink(__DIR__) ); 19 20echo "\n*** Testing realpath() on a non-existent file ***\n"; 21var_dump( realpath(__DIR__."/realpath_error.tmp") ); 22 23echo "Done\n"; 24?> 25--EXPECTF-- 26*** Testing readlink() on a non-existent link *** 27 28Warning: readlink(): No such file or directory in %s on line %d 29bool(false) 30 31*** Testing readlink() on existing file *** 32 33Warning: readlink(): Invalid argument in %s on line %d 34bool(false) 35 36*** Testing readlink() on existing directory *** 37 38Warning: readlink(): Invalid argument in %s on line %d 39bool(false) 40 41*** Testing realpath() on a non-existent file *** 42%s 43Done 44