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