1--TEST--
2Test parse_str() function : test with badly formed strings
3--FILE--
4<?php
5echo "\nTest string with badly formed strings\n";
6$str = "arr[1=sid&arr[4][2=fred";
7var_dump(parse_str($str, $res));
8var_dump($res);
9
10$str = "arr1]=sid&arr[4]2]=fred";
11var_dump(parse_str($str, $res));
12var_dump($res);
13
14$str = "arr[one=sid&arr[4][two=fred";
15var_dump(parse_str($str, $res));
16var_dump($res);
17
18echo "\nTest string with badly formed % numbers\n";
19$str = "first=%41&second=%a&third=%b";
20var_dump(parse_str($str, $res));
21var_dump($res);
22
23echo "\nTest string with non-binary safe name\n";
24$str = "arr.test[1]=sid&arr test[4][two]=fred";
25var_dump(parse_str($str, $res));
26var_dump($res);
27?>
28--EXPECTF--
29Test string with badly formed strings
30NULL
31array(2) {
32  ["arr_1"]=>
33  string(3) "sid"
34  ["arr"]=>
35  array(1) {
36    [4]=>
37    string(4) "fred"
38  }
39}
40NULL
41array(2) {
42  ["arr1]"]=>
43  string(3) "sid"
44  ["arr"]=>
45  array(1) {
46    [4]=>
47    string(4) "fred"
48  }
49}
50NULL
51array(2) {
52  ["arr_one"]=>
53  string(3) "sid"
54  ["arr"]=>
55  array(1) {
56    [4]=>
57    string(4) "fred"
58  }
59}
60
61Test string with badly formed % numbers
62NULL
63array(3) {
64  ["first"]=>
65  string(1) "A"
66  ["second"]=>
67  string(2) "%a"
68  ["third"]=>
69  string(2) "%b"
70}
71
72Test string with non-binary safe name
73NULL
74array(1) {
75  ["arr_test"]=>
76  array(2) {
77    [1]=>
78    string(3) "sid"
79    [4]=>
80    array(1) {
81      ["two"]=>
82      string(4) "fred"
83    }
84  }
85}
86