Annotation of embedaddon/php/ext/xml/tests/xml_parse_into_struct_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test xml_parse_into_struct() function : usage variations - different types for parser
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("xml")) {
6: print "skip - XML extension not loaded";
7: }
8: ?>
9: --FILE--
10: <?php
11: /* Prototype : proto int xml_parse_into_struct(resource parser, string data, array &struct, array &index)
12: * Description: Parsing a XML document
13: * Source code: ext/xml/xml.c
14: * Alias to functions:
15: */
16:
17: echo "*** Testing xml_parse_into_struct() : usage variations ***\n";
18: error_reporting(E_ALL & ~E_NOTICE);
19:
20: class aClass {
21: function __toString() {
22: return "Some Ascii Data";
23: }
24: }
25: // Initialise function arguments not being substituted (if any)
26: $data = 'string_val';
27:
28: //get an unset variable
29: $unset_var = 10;
30: unset ($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:
90: foreach($values as $value) {
91: echo "\nArg value $value \n";
92: var_dump( xml_parse_into_struct($value, $data, $struct, $index) );
93: };
94:
95: fclose($fp);
96: echo "Done";
97: ?>
98: --EXPECTF--
99: *** Testing xml_parse_into_struct() : usage variations ***
100:
101: Arg value 0
102:
103: Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d
104: NULL
105:
106: Arg value 1
107:
108: Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d
109: NULL
110:
111: Arg value 12345
112:
113: Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d
114: NULL
115:
116: Arg value -2345
117:
118: Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d
119: NULL
120:
121: Arg value 10.5
122:
123: Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d
124: NULL
125:
126: Arg value -10.5
127:
128: Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d
129: NULL
130:
131: Arg value 101234567000
132:
133: Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d
134: NULL
135:
136: Arg value 1.07654321E-9
137:
138: Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d
139: NULL
140:
141: Arg value 0.5
142:
143: Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d
144: NULL
145:
146: Arg value Array
147:
148: Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d
149: NULL
150:
151: Arg value Array
152:
153: Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d
154: NULL
155:
156: Arg value Array
157:
158: Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d
159: NULL
160:
161: Arg value Array
162:
163: Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d
164: NULL
165:
166: Arg value Array
167:
168: Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d
169: NULL
170:
171: Arg value
172:
173: Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d
174: NULL
175:
176: Arg value
177:
178: Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d
179: NULL
180:
181: Arg value 1
182:
183: Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d
184: NULL
185:
186: Arg value
187:
188: Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d
189: NULL
190:
191: Arg value 1
192:
193: Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d
194: NULL
195:
196: Arg value
197:
198: Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d
199: NULL
200:
201: Arg value
202:
203: Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d
204: NULL
205:
206: Arg value
207:
208: Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d
209: NULL
210:
211: Arg value string
212:
213: Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d
214: NULL
215:
216: Arg value string
217:
218: Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d
219: NULL
220:
221: Arg value Some Ascii Data
222:
223: Warning: xml_parse_into_struct() expects parameter 1 to be resource, object given in %s on line %d
224: NULL
225:
226: Arg value Resource id %s
227:
228: Warning: xml_parse_into_struct(): supplied resource is not a valid XML Parser resource in %s on line %d
229: bool(false)
230:
231: Arg value
232:
233: Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d
234: NULL
235:
236: Arg value
237:
238: Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d
239: NULL
240: Done
241:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>