Annotation of embedaddon/php/ext/standard/tests/file/readfile_variation10-win32.phpt, revision 1.1.1.2
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";
1.1.1.2 ! misho 40: readfile($value);
1.1 misho 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:
52: -- Filename: TRUE --
53:
54: Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d
55:
56: -- Filename: FALSE --
57:
58: Warning: readfile(): Filename cannot be empty in %s on line %d
59:
60: -- Filename: NULL --
61:
62: Warning: readfile(): Filename cannot be empty in %s on line %d
63:
64: -- Filename: "" --
65:
66: Warning: readfile(): Filename cannot be empty in %s on line %d
67:
68: -- Filename: " " --
69:
70: Warning: readfile( ): failed to open stream: Permission denied in %s on line %d
71:
72: -- Filename: \0 --
1.1.1.2 ! misho 73:
! 74: Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d
1.1 misho 75:
76: -- Filename: array() --
77:
1.1.1.2 ! misho 78: Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d
1.1 misho 79:
80: -- Filename: /no/such/file/dir --
81:
82: Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
83:
84: -- Filename: php/php --
85:
86: Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d
1.1.1.2 ! misho 87: ===Done===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>