Annotation of embedaddon/php/ext/standard/tests/file/readfile_variation10.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 Not for 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:
21: /* An array of files */
22: $names_arr = array(
23: /* Invalid args */
24: -1,
25: TRUE,
26: FALSE,
27: NULL,
28: "",
29: " ",
30: "\0",
31: array(),
32:
33: /* prefix with path separator of a non existing directory*/
34: "/no/such/file/dir",
35: "php/php"
36:
37: );
38:
39: for( $i=0; $i<count($names_arr); $i++ ) {
40: $name = $names_arr[$i];
41: echo "-- testing '$name' --\n";
1.1.1.2 ! misho 42: readfile($name);
1.1 misho 43: }
44:
45: echo "\n*** Done ***\n";
46: ?>
47: --EXPECTF--
48: *** Testing readfile() : variation ***
49: -- testing '-1' --
50:
51: Warning: readfile(-1): failed to open stream: %s in %s on line %d
52: -- testing '1' --
53:
54: Warning: readfile(1): failed to open stream: %s in %s on line %d
55: -- testing '' --
56:
57: Warning: readfile(): Filename cannot be empty in %s on line %d
58: -- testing '' --
59:
60: Warning: readfile(): Filename cannot be empty in %s on line %d
61: -- testing '' --
62:
63: Warning: readfile(): Filename cannot be empty in %s on line %d
64: -- testing ' ' --
65:
66: Warning: readfile( ): failed to open stream: %s in %s on line %d
67: -- testing ' ' --
1.1.1.2 ! misho 68:
! 69: Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d
! 70:
! 71: Notice: Array to string conversion in %s line %d
1.1 misho 72: -- testing 'Array' --
73:
1.1.1.2 ! misho 74: Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d
1.1 misho 75: -- testing '%sdir' --
76:
77: Warning: readfile(%sdir): failed to open stream: %s in %s on line %d
78: -- testing '%sphp' --
79:
80: Warning: readfile(%sphp): failed to open stream: %s in %s on line %d
81:
82: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>