File: readlink_realpath_variation3.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (52 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--TEST--
Test readlink() and realpath() functions: usage variation - invalid args
--FILE--
<?php
echo "*** Testing readlink() and realpath() : usage variations ***\n";

echo "\n*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***\n";
$link_string = array (
  /* linkname as spaces */
  " ",
  ' ',

  /* empty linkname */
  "",
  '',
 );
for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) {
  echo "-- Iteration";
  echo $loop_counter + 1;
  echo " --\n";

  var_dump( readlink($link_string[$loop_counter]) );
  var_dump( realpath($link_string[$loop_counter]) );
}

echo "Done\n";
?>
--EXPECTF--
*** Testing readlink() and realpath() : usage variations ***

*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***
-- Iteration1 --

Warning: readlink(): %s in %s on line %d
bool(false)
%s
-- Iteration2 --

Warning: readlink(): %s in %s on line %d
bool(false)
%s
-- Iteration3 --

Warning: readlink(): %s in %s on line %d
bool(false)
string(%d) "%s"
-- Iteration4 --

Warning: readlink(): %s in %s on line %d
bool(false)
string(%d) "%s"
Done