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