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  [%u|b%"test"]=>
97  %unicode|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  [%u|b%"test"]=>
109  %unicode|string%(8) "new
110line"
111}
112array(1) {
113  [%u|b%"test"]=>
114  %unicode|string%(16) "test const value"
115}
116array(1) {
117  [%u|b%"section"]=>
118  array(1) {
119    [%u|b%"test"]=>
120    %unicode|string%(5) "hello"
121  }
122}
123array(1) {
124  [%u|b%"test"]=>
125  %unicode|string%(5) "hello"
126}
127array(1) {
128  [%u|b%"section.test"]=>
129  %unicode|string%(5) "hello"
130}
131array(1) {
132  [%u|b%"section"]=>
133  array(1) {
134    [%u|b%"section.test"]=>
135    %unicode|string%(5) "hello"
136  }
137}
138array(1) {
139  [%u|b%"section"]=>
140  array(1) {
141    [1]=>
142    %unicode|string%(1) "2"
143  }
144}
145array(1) {
146  [1]=>
147  %unicode|string%(1) "2"
148}
149array(1) {
150  [%u|b%"test"]=>
151  %unicode|string%(5) "test4"
152}
153array(1) {
154  [%u|b%"section1"]=>
155  array(1) {
156    [%u|b%"name"]=>
157    %unicode|string%(5) "value"
158  }
159}
160array(3) {
161  [%u|b%"foo"]=>
162  %unicode|string%(4) "bar1"
163  [%u|b%"_foo"]=>
164  %unicode|string%(4) "bar2"
165  [%u|b%"foo_"]=>
166  %unicode|string%(4) "bar3"
167}
168Done
169