1--TEST-- 2Test readlink() and realpath() functions: usage variation - invalid args 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/* 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() and realpath() : usage variations ***\n"; 19 20echo "\n*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***\n"; 21$link_string = array ( 22 /* linkname as spaces */ 23 " ", 24 ' ', 25 26 /* empty linkname */ 27 "", 28 '', 29 NULL, 30 null 31 ); 32for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) { 33 echo "-- Iteration"; 34 echo $loop_counter + 1; 35 echo " --\n"; 36 37 var_dump( readlink($link_string[$loop_counter]) ); 38 var_dump( realpath($link_string[$loop_counter]) ); 39} 40 41echo "Done\n"; 42?> 43--EXPECTF-- 44*** Testing readlink() and realpath() : usage variations *** 45 46*** Testing readlink() and realpath() with linkname as empty string, NULL and single space *** 47-- Iteration1 -- 48 49Warning: readlink(): %s in %s on line %d 50bool(false) 51%s 52-- Iteration2 -- 53 54Warning: readlink(): %s in %s on line %d 55bool(false) 56%s 57-- Iteration3 -- 58 59Warning: readlink(): %s in %s on line %d 60bool(false) 61string(%d) "%s" 62-- Iteration4 -- 63 64Warning: readlink(): %s in %s on line %d 65bool(false) 66string(%d) "%s" 67-- Iteration5 -- 68 69Warning: readlink(): %s in %s on line %d 70bool(false) 71string(%d) "%s" 72-- Iteration6 -- 73 74Warning: readlink(): %s in %s on line %d 75bool(false) 76string(%d) "%s" 77Done 78