1--TEST--
2mb_parse_str() test 2
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5--INI--
6arg_separator.input=&#
7register_globals=0
8--FILE--
9<?php
10$queries = array(
11	"foo=abc#bar=def&fubar=ghi",
12	"%2bfoo=def&-bar=jkl#+fubar",
13	"  foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]=="
14);
15function test($query) {
16	$foo = '';
17	$bar = '';
18	$fubar = '';
19	mb_parse_str($query, $array);
20	var_dump($array);
21	var_dump($foo);
22	var_dump($bar);
23	var_dump($fubar);
24	mb_parse_str($query);
25	var_dump($foo);
26	var_dump($bar);
27	var_dump($fubar);
28}
29foreach ($queries as $query) {
30	test($query);
31}
32?>
33--EXPECT--
34array(3) {
35  ["foo"]=>
36  string(3) "abc"
37  ["bar"]=>
38  string(3) "def"
39  ["fubar"]=>
40  string(3) "ghi"
41}
42string(0) ""
43string(0) ""
44string(0) ""
45string(3) "abc"
46string(3) "def"
47string(3) "ghi"
48array(3) {
49  ["+foo"]=>
50  string(3) "def"
51  ["-bar"]=>
52  string(3) "jkl"
53  ["fubar"]=>
54  string(0) ""
55}
56string(0) ""
57string(0) ""
58string(0) ""
59string(0) ""
60string(0) ""
61string(0) ""
62array(3) {
63  ["foo"]=>
64  array(4) {
65    [0]=>
66    string(3) "abc"
67    [1]=>
68    string(3) "def"
69    [2]=>
70    string(3) "ghi"
71    [3]=>
72    string(0) ""
73  }
74  ["bar"]=>
75  array(1) {
76    [0]=>
77    string(0) ""
78  }
79  ["fubar"]=>
80  array(1) {
81    [0]=>
82    string(1) "="
83  }
84}
85string(0) ""
86string(0) ""
87string(0) ""
88array(4) {
89  [0]=>
90  string(3) "abc"
91  [1]=>
92  string(3) "def"
93  [2]=>
94  string(3) "ghi"
95  [3]=>
96  string(0) ""
97}
98array(1) {
99  [0]=>
100  string(0) ""
101}
102array(1) {
103  [0]=>
104  string(1) "="
105}
106