Annotation of embedaddon/php/ext/standard/tests/file/fpassthru_variation1.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test fpassthru() function : usage variations - different parameter types
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --FILE--
6: <?php
7: /* Prototype : proto int fpassthru(resource fp)
8: * Description: Output all remaining data from a file pointer
9: * Source code: ext/standard/file.c
10: * Alias to functions: gzpassthru
11: */
12:
13: echo "*** Testing fpassthru() : usage variations ***\n";
14: error_reporting(E_ALL & ~E_NOTICE);
15:
16: //get an unset variable
17: $unset_var = 10;
18: unset ($unset_var);
19:
20: class testClass {
21: public function __toString() {
22: return "testClass";
23: }
24: }
25:
26: //array of values to iterate over
27: $values = array(
28:
29: // int data
30: 0,
31: 1,
32: 12345,
33: -2345,
34:
35: // float data
36: 10.5,
37: -10.5,
38: 10.1234567e10,
39: 10.7654321E-10,
40: .5,
41:
42: // array data
43: array(),
44: array(0),
45: array(1),
46: array(1, 2),
47: array('color' => 'red', 'item' => 'pen'),
48:
49: // null data
50: NULL,
51: null,
52:
53: // boolean data
54: true,
55: false,
56: TRUE,
57: FALSE,
58:
59: // empty data
60: "",
61: '',
62:
63: // string data
64: "string",
65: 'string',
66:
67: // object data
68: new testClass(),
69:
70: // undefined data
71: $undefined_var,
72:
73: // unset data
74: $unset_var,
75: );
76:
77: // loop through each element of the array for fp
78:
79: foreach($values as $value) {
1.1.1.2 ! misho 80: echo @"\nArg value $value \n";
1.1 misho 81: var_dump( fpassthru($value) );
82: };
83:
84: echo "Done";
85: ?>
86: --EXPECTF--
87: *** Testing fpassthru() : usage variations ***
88:
89: Arg value 0
90:
91: Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
92: bool(false)
93:
94: Arg value 1
95:
96: Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
97: bool(false)
98:
99: Arg value 12345
100:
101: Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
102: bool(false)
103:
104: Arg value -2345
105:
106: Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
107: bool(false)
108:
109: Arg value 10.5
110:
111: Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
112: bool(false)
113:
114: Arg value -10.5
115:
116: Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
117: bool(false)
118:
119: Arg value 101234567000
120:
121: Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
122: bool(false)
123:
124: Arg value 1.07654321E-9
125:
126: Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
127: bool(false)
128:
129: Arg value 0.5
130:
131: Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
132: bool(false)
133:
134: Arg value Array
135:
136: Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
137: bool(false)
138:
139: Arg value Array
140:
141: Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
142: bool(false)
143:
144: Arg value Array
145:
146: Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
147: bool(false)
148:
149: Arg value Array
150:
151: Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
152: bool(false)
153:
154: Arg value Array
155:
156: Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
157: bool(false)
158:
159: Arg value
160:
161: Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
162: bool(false)
163:
164: Arg value
165:
166: Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
167: bool(false)
168:
169: Arg value 1
170:
171: Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
172: bool(false)
173:
174: Arg value
175:
176: Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
177: bool(false)
178:
179: Arg value 1
180:
181: Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
182: bool(false)
183:
184: Arg value
185:
186: Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
187: bool(false)
188:
189: Arg value
190:
191: Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
192: bool(false)
193:
194: Arg value
195:
196: Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
197: bool(false)
198:
199: Arg value string
200:
201: Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
202: bool(false)
203:
204: Arg value string
205:
206: Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
207: bool(false)
208:
209: Arg value testClass
210:
211: Warning: fpassthru() expects parameter 1 to be resource, object given in %s on line %d
212: bool(false)
213:
214: Arg value
215:
216: Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
217: bool(false)
218:
219: Arg value
220:
221: Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
222: bool(false)
223: Done
224:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>