1--TEST-- 2Test readlink() and realpath() functions: error conditions 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN') { 6 die('skip only for Windows'); 7} 8?> 9--FILE-- 10<?php 11/* Prototype: string readlink ( string $path ); 12 Description: Returns the target of a symbolic link 13 14 Prototype: string realpath ( string $path ); 15 Description: Returns canonicalized absolute pathname 16*/ 17 18echo "*** Testing readlink(): error conditions ***\n"; 19var_dump( readlink() ); // args < expected 20var_dump( readlink(__FILE__, 2) ); // args > expected 21 22echo "\n*** Testing readlink() on a non-existent link ***\n"; 23var_dump( readlink(__DIR__."/readlink_error.tmp") ); 24 25echo "\n*** Testing readlink() on existing file ***\n"; 26var_dump( readlink(__FILE__) ); 27 28echo "\n*** Testing readlink() on existing directory ***\n"; 29var_dump( readlink(__DIR__) ); 30 31echo "*** Testing realpath(): error conditions ***\n"; 32var_dump( realpath() ); // args < expected 33var_dump( realpath(1, 2) ); // args > expected 34 35echo "\n*** Testing realpath() on a non-existent file ***\n"; 36var_dump( realpath(__DIR__."/realpath_error.tmp") ); 37 38echo "Done\n"; 39?> 40--EXPECTF-- 41*** Testing readlink(): error conditions *** 42 43Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d 44NULL 45 46Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d 47NULL 48 49*** Testing readlink() on a non-existent link *** 50 51Warning: readlink(): readlink failed to read the symbolic link (%s, error %d) in %s on line %d 52bool(false) 53 54*** Testing readlink() on existing file *** 55string(%d) "%s%eext%estandard%etests%efile%ereadlink_realpath_error-win32.php" 56 57*** Testing readlink() on existing directory *** 58string(%d) "%s%eext%estandard%etests%efile" 59*** Testing realpath(): error conditions *** 60 61Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d 62NULL 63 64Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d 65NULL 66 67*** Testing realpath() on a non-existent file *** 68%s 69Done 70