Annotation of embedaddon/php/ext/standard/tests/file/readfile_variation10-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test readfile() function : variation - various invalid paths
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --SKIPIF--
6: <?php
7: if(substr(PHP_OS, 0, 3) != "WIN")
8: die("skip run only on Windows");
9: ?>
10: --FILE--
11: <?php
12: /* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
13: * Description: Output a file or a URL
14: * Source code: ext/standard/file.c
15: * Alias to functions:
16: */
17:
18: echo "*** Testing readfile() : variation ***\n";
19:
20: /* An array of files */
21: $names_arr = array(
22: /* Invalid args */
23: "-1" => -1,
24: "TRUE" => TRUE,
25: "FALSE" => FALSE,
26: "NULL" => NULL,
27: "\"\"" => "",
28: "\" \"" => " ",
29: "\\0" => "\0",
30: "array()" => array(),
31:
32: /* prefix with path separator of a non existing directory*/
33: "/no/such/file/dir" => "/no/such/file/dir",
34: "php/php"=> "php/php"
35:
36: );
37:
38: foreach($names_arr as $key => $value) {
39: echo "\n-- Filename: $key --\n";
40: var_dump(readfile($value));
41: };
42:
43: ?>
44: ===Done===
45: --EXPECTF--
46: *** Testing readfile() : variation ***
47:
48: -- Filename: -1 --
49:
50: Warning: readfile(-1): failed to open stream: No such file or directory in %s on line %d
51: bool(false)
52:
53: -- Filename: TRUE --
54:
55: Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d
56: bool(false)
57:
58: -- Filename: FALSE --
59:
60: Warning: readfile(): Filename cannot be empty in %s on line %d
61: bool(false)
62:
63: -- Filename: NULL --
64:
65: Warning: readfile(): Filename cannot be empty in %s on line %d
66: bool(false)
67:
68: -- Filename: "" --
69:
70: Warning: readfile(): Filename cannot be empty in %s on line %d
71: bool(false)
72:
73: -- Filename: " " --
74:
75: Warning: readfile( ): failed to open stream: Permission denied in %s on line %d
76: bool(false)
77:
78: -- Filename: \0 --
79: bool(false)
80:
81: -- Filename: array() --
82:
83: Warning: readfile() expects parameter 1 to be string, array given in %s on line %d
84: bool(false)
85:
86: -- Filename: /no/such/file/dir --
87:
88: Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
89: bool(false)
90:
91: -- Filename: php/php --
92:
93: Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d
94: bool(false)
95: ===Done===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>