1--TEST--
2parse_ini_string() multiple calls
3--FILE--
4<?php
5
6var_dump(parse_ini_string());
7var_dump(parse_ini_string(1,1,1,1));
8
9$ini = "
10test =
11";
12var_dump(parse_ini_string($ini));
13$ini = "
14test==
15";
16var_dump(parse_ini_string($ini));
17
18$ini = "
19test=test=
20";
21var_dump(parse_ini_string($ini));
22
23$ini = "
24test= \"new
25line\"
26";
27var_dump(parse_ini_string($ini));
28
29define("TEST_CONST", "test const value");
30$ini = "
31test=TEST_CONST
32";
33var_dump(parse_ini_string($ini));
34
35$ini = "
36[section]
37test=hello
38";
39var_dump(parse_ini_string($ini, true));
40
41$ini = "
42[section]
43test=hello
44";
45var_dump(parse_ini_string($ini, false));
46
47$ini = "
48section.test=hello
49";
50var_dump(parse_ini_string($ini, true));
51
52$ini = "
53[section]
54section.test=hello
55";
56var_dump(parse_ini_string($ini, true));
57
58$ini = "
59[section]
601=2
61";
62var_dump(parse_ini_string($ini, true));
63
64$ini = "
651=2
66";
67var_dump(parse_ini_string($ini, true));
68$ini = "
69test=test2
70test=test3
71test=test4
72";
73var_dump(parse_ini_string($ini, true));
74
75/* From bug #44574 */
76$ini = "[section1]\nname = value";
77var_dump(parse_ini_string($ini, true));
78
79/* #44842, labels starting with underscore */
80$ini = <<<'INI'
81foo=bar1
82_foo=bar2
83foo_=bar3
84INI;
85var_dump(parse_ini_string($ini, true));
86
87echo "Done\n";
88?>
89--EXPECTF--
90Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s
91bool(false)
92
93Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s
94bool(false)
95array(1) {
96  ["test"]=>
97  string(0) ""
98}
99
100Warning: syntax error, unexpected '='%sin Unknown on line 2
101 in %s
102bool(false)
103
104Warning: syntax error, unexpected '='%sin Unknown on line 2
105 in %s
106bool(false)
107array(1) {
108  ["test"]=>
109  string(8) "new
110line"
111}
112array(1) {
113  ["test"]=>
114  string(16) "test const value"
115}
116array(1) {
117  ["section"]=>
118  array(1) {
119    ["test"]=>
120    string(5) "hello"
121  }
122}
123array(1) {
124  ["test"]=>
125  string(5) "hello"
126}
127array(1) {
128  ["section.test"]=>
129  string(5) "hello"
130}
131array(1) {
132  ["section"]=>
133  array(1) {
134    ["section.test"]=>
135    string(5) "hello"
136  }
137}
138array(1) {
139  ["section"]=>
140  array(1) {
141    [1]=>
142    string(1) "2"
143  }
144}
145array(1) {
146  [1]=>
147  string(1) "2"
148}
149array(1) {
150  ["test"]=>
151  string(5) "test4"
152}
153array(1) {
154  ["section1"]=>
155  array(1) {
156    ["name"]=>
157    string(5) "value"
158  }
159}
160array(3) {
161  ["foo"]=>
162  string(4) "bar1"
163  ["_foo"]=>
164  string(4) "bar2"
165  ["foo_"]=>
166  string(4) "bar3"
167}
168Done
169