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