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