1--TEST--
2Test fpassthru() function : usage variations  - different parameter types
3--CREDITS--
4Dave 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
13echo "*** Testing fpassthru() : usage variations ***\n";
14error_reporting(E_ALL & ~E_NOTICE);
15
16//get an unset variable
17$unset_var = 10;
18unset ($unset_var);
19
20class 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
79foreach($values as $value) {
80      echo "\nArg value $value \n";
81      var_dump( fpassthru($value) );
82};
83
84echo "Done";
85?>
86--EXPECTF--
87*** Testing fpassthru() : usage variations ***
88
89Arg value 0
90
91Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
92bool(false)
93
94Arg value 1
95
96Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
97bool(false)
98
99Arg value 12345
100
101Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
102bool(false)
103
104Arg value -2345
105
106Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
107bool(false)
108
109Arg value 10.5
110
111Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
112bool(false)
113
114Arg value -10.5
115
116Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
117bool(false)
118
119Arg value 101234567000
120
121Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
122bool(false)
123
124Arg value 1.07654321E-9
125
126Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
127bool(false)
128
129Arg value 0.5
130
131Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
132bool(false)
133
134Arg value Array
135
136Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
137bool(false)
138
139Arg value Array
140
141Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
142bool(false)
143
144Arg value Array
145
146Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
147bool(false)
148
149Arg value Array
150
151Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
152bool(false)
153
154Arg value Array
155
156Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
157bool(false)
158
159Arg value
160
161Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
162bool(false)
163
164Arg value
165
166Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
167bool(false)
168
169Arg value 1
170
171Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
172bool(false)
173
174Arg value
175
176Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
177bool(false)
178
179Arg value 1
180
181Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
182bool(false)
183
184Arg value
185
186Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
187bool(false)
188
189Arg value
190
191Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
192bool(false)
193
194Arg value
195
196Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
197bool(false)
198
199Arg value string
200
201Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
202bool(false)
203
204Arg value string
205
206Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
207bool(false)
208
209Arg value testClass
210
211Warning: fpassthru() expects parameter 1 to be resource, object given in %s on line %d
212bool(false)
213
214Arg value
215
216Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
217bool(false)
218
219Arg value
220
221Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
222bool(false)
223Done
224
225