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