Annotation of embedaddon/php/ext/mbstring/tests/mb_parse_str.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: mb_parse_str()
3: --SKIPIF--
4: <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5: --INI--
6: arg_separator.input=&
7: register_globals=0
8: --FILE--
9: <?php
10: $queries = array(
11: "foo=abc&bar=def",
12: "%2bfoo=def&-bar=jkl",
13: "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl"
14: );
15: function test($query) {
16: $foo = '';
17: $bar = '';
18: mb_parse_str($query, $array);
19: var_dump($array);
20: var_dump($foo);
21: var_dump($bar);
22: mb_parse_str($query);
23: var_dump($foo);
24: var_dump($bar);
25: }
26: foreach ($queries as $query) {
27: test($query);
28: }
29: ?>
30: --EXPECT--
31: array(2) {
32: ["foo"]=>
33: string(3) "abc"
34: ["bar"]=>
35: string(3) "def"
36: }
37: string(0) ""
38: string(0) ""
39: string(3) "abc"
40: string(3) "def"
41: array(2) {
42: ["+foo"]=>
43: string(3) "def"
44: ["-bar"]=>
45: string(3) "jkl"
46: }
47: string(0) ""
48: string(0) ""
49: string(0) ""
50: string(0) ""
51: array(2) {
52: ["foo"]=>
53: array(3) {
54: [0]=>
55: string(3) "abc"
56: [1]=>
57: string(3) "def"
58: [2]=>
59: string(3) "ghi"
60: }
61: ["bar"]=>
62: array(1) {
63: [0]=>
64: string(3) "jkl"
65: }
66: }
67: string(0) ""
68: string(0) ""
69: array(3) {
70: [0]=>
71: string(3) "abc"
72: [1]=>
73: string(3) "def"
74: [2]=>
75: string(3) "ghi"
76: }
77: array(1) {
78: [0]=>
79: string(3) "jkl"
80: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>