Annotation of embedaddon/php/ext/xml/tests/xml_parser_create_ns_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test xml_parser_create_ns() function : usage variations
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 resource xml_parser_create_ns([string encoding [, string sep]])
12: * Description: Create an XML parser
13: * Source code: ext/xml/xml.c
14: * Alias to functions:
15: */
16:
17: echo "*** Testing xml_parser_create_ns() : 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:
27: //get an unset variable
28: $unset_var = 10;
29: unset ($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: "ISO-8859-1",
74: "UTF-8",
75: "US-ASCII",
76: "UTF-32",
77:
78: // object data
79: new aClass(),
80:
81: // resource data
82: $fp,
83:
84: // undefined data
85: $undefined_var,
86:
87: // unset data
88: $unset_var,
89: );
90:
91: // loop through each element of the array for encoding
92:
93: foreach($values as $value) {
94: echo "\nArg value $value \n";
95: $res = xml_parser_create_ns($value);
96: var_dump($res);
97: if ($res !== false) {
98: xml_parser_free($res);
99: }
100: };
101:
102: fclose($fp);
103: echo "Done";
104: ?>
105: --EXPECTF--
106: *** Testing xml_parser_create_ns() : usage variations ***
107:
108: Arg value 0
109:
110: Warning: xml_parser_create_ns(): unsupported source encoding "0" in %s on line %d
111: bool(false)
112:
113: Arg value 1
114:
115: Warning: xml_parser_create_ns(): unsupported source encoding "1" in %s on line %d
116: bool(false)
117:
118: Arg value 12345
119:
120: Warning: xml_parser_create_ns(): unsupported source encoding "12345" in %s on line %d
121: bool(false)
122:
123: Arg value -2345
124:
125: Warning: xml_parser_create_ns(): unsupported source encoding "-2345" in %s on line %d
126: bool(false)
127:
128: Arg value 10.5
129:
130: Warning: xml_parser_create_ns(): unsupported source encoding "10.5" in %s on line %d
131: bool(false)
132:
133: Arg value -10.5
134:
135: Warning: xml_parser_create_ns(): unsupported source encoding "-10.5" in %s on line %d
136: bool(false)
137:
138: Arg value 101234567000
139:
140: Warning: xml_parser_create_ns(): unsupported source encoding "101234567000" in %s on line %d
141: bool(false)
142:
143: Arg value 1.07654321E-9
144:
145: Warning: xml_parser_create_ns(): unsupported source encoding "1.07654321E-9" in %s on line %d
146: bool(false)
147:
148: Arg value 0.5
149:
150: Warning: xml_parser_create_ns(): unsupported source encoding "0.5" in %s on line %d
151: bool(false)
152:
153: Arg value Array
154:
155: Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d
156: bool(false)
157:
158: Arg value Array
159:
160: Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d
161: bool(false)
162:
163: Arg value Array
164:
165: Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d
166: bool(false)
167:
168: Arg value Array
169:
170: Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d
171: bool(false)
172:
173: Arg value Array
174:
175: Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d
176: bool(false)
177:
178: Arg value
179: resource(%d) of type (xml)
180:
181: Arg value
182: resource(%d) of type (xml)
183:
184: Arg value 1
185:
186: Warning: xml_parser_create_ns(): unsupported source encoding "1" in %s on line %d
187: bool(false)
188:
189: Arg value
190: resource(%d) of type (xml)
191:
192: Arg value 1
193:
194: Warning: xml_parser_create_ns(): unsupported source encoding "1" in %s on line %d
195: bool(false)
196:
197: Arg value
198: resource(%d) of type (xml)
199:
200: Arg value
201: resource(%d) of type (xml)
202:
203: Arg value
204: resource(%d) of type (xml)
205:
206: Arg value string
207:
208: Warning: xml_parser_create_ns(): unsupported source encoding "string" in %s on line %d
209: bool(false)
210:
211: Arg value string
212:
213: Warning: xml_parser_create_ns(): unsupported source encoding "string" in %s on line %d
214: bool(false)
215:
216: Arg value ISO-8859-1
217: resource(%d) of type (xml)
218:
219: Arg value UTF-8
220: resource(%d) of type (xml)
221:
222: Arg value US-ASCII
223: resource(%d) of type (xml)
224:
225: Arg value UTF-32
226:
227: Warning: xml_parser_create_ns(): unsupported source encoding "UTF-32" in %s on line %d
228: bool(false)
229:
230: Arg value Some Ascii Data
231:
232: Warning: xml_parser_create_ns(): unsupported source encoding "Some Ascii Data" in %s on line %d
233: bool(false)
234:
235: Arg value Resource id %s
236:
237: Warning: xml_parser_create_ns() expects parameter 1 to be string, resource given in %s on line %d
238: bool(false)
239:
240: Arg value
241: resource(%d) of type (xml)
242:
243: Arg value
244: resource(%d) of type (xml)
245: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>