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