1--TEST-- 2parse_ini_file() tests 3--ENV-- 4basicval=FUBAR_VARIABLE 5basicqval=FUBAR_QUOTES_VARIABLE 6--FILE-- 7<?php 8 9$ini_file = __DIR__."/parse_ini_basic.data"; 10 11define('TEST_CONSTANT', 'this_is_test_constant'); 12 13var_dump(parse_ini_file($ini_file, 1)); 14 15echo "Done.\n"; 16?> 17--EXPECT-- 18array(26) { 19 ["basic"]=> 20 array(15) { 21 ["basicval"]=> 22 string(3) "bar" 23 ["longval"]=> 24 string(5) "12345" 25 ["with.dot"]=> 26 string(7) "fooobar" 27 ["boolon"]=> 28 string(1) "1" 29 ["booltrue"]=> 30 string(1) "1" 31 ["boolyes"]=> 32 string(1) "1" 33 ["booloff"]=> 34 string(0) "" 35 ["boolfalse"]=> 36 string(0) "" 37 ["boolnone"]=> 38 string(0) "" 39 ["boolno"]=> 40 string(0) "" 41 ["string"]=> 42 string(34) "asdadfsdjkslkj ¡@£$$ { }[ ]/%#¤" 43 ["sqstring"]=> 44 string(14) "adsasdadasdasd" 45 ["dqstring"]=> 46 string(51) "asdadfsdjkslkj ¡@£$$ { } !^~|¥¥{[()/)&/% ¤ # #" 47 ["php_constant"]=> 48 string(1) "2" 49 ["user_constant"]=> 50 string(21) "this_is_test_constant" 51 } 52 ["basic with whitespace"]=> 53 array(13) { 54 ["basicval"]=> 55 string(3) "bar" 56 ["longval"]=> 57 string(5) "12345" 58 ["with.dot"]=> 59 string(7) "fooobar" 60 ["boolon"]=> 61 string(1) "1" 62 ["booltrue"]=> 63 string(1) "1" 64 ["boolyes"]=> 65 string(1) "1" 66 ["booloff"]=> 67 string(0) "" 68 ["boolfalse"]=> 69 string(0) "" 70 ["boolnone"]=> 71 string(0) "" 72 ["boolno"]=> 73 string(0) "" 74 ["sqstring"]=> 75 string(14) "adsasdadasdasd" 76 ["dqstring"]=> 77 string(41) "asdadfsdjkslkj ¡@£$$€¥¥{[()/)&/%#¤" 78 ["php_constant"]=> 79 string(1) "2" 80 } 81 ["comments"]=> 82 array(1) { 83 ["somecomment"]=> 84 string(15) "comment follows" 85 } 86 ["variables"]=> 87 array(8) { 88 ["var1"]=> 89 string(14) "FUBAR_VARIABLE" 90 ["var2"]=> 91 string(18) "FUBAR_VARIABLE/foo" 92 ["var3"]=> 93 string(18) "foo/FUBAR_VARIABLE" 94 ["var4"]=> 95 string(22) "foo/FUBAR_VARIABLE/foo" 96 ["quoted_var1"]=> 97 string(21) "FUBAR_QUOTES_VARIABLE" 98 ["quoted_var2"]=> 99 string(25) "FUBAR_QUOTES_VARIABLE/foo" 100 ["quoted_var3"]=> 101 string(25) "foo/FUBAR_QUOTES_VARIABLE" 102 ["quoted_var4"]=> 103 string(29) "foo/FUBAR_QUOTES_VARIABLE/foo" 104 } 105 ["offset values"]=> 106 array(6) { 107 ["foo1"]=> 108 array(2) { 109 [0]=> 110 string(14) "basic offset 1" 111 [1]=> 112 string(14) "basic offset 2" 113 } 114 ["foo2"]=> 115 array(1) { 116 [123]=> 117 string(11) "long offset" 118 } 119 ["foo3"]=> 120 array(1) { 121 ["abc"]=> 122 string(13) "string offset" 123 } 124 ["foo4"]=> 125 array(4) { 126 [0]=> 127 string(15) "quoted offset 1" 128 [" "]=> 129 string(15) "quoted offset 2" 130 ["sqfoobar"]=> 131 string(20) "quoted string offset" 132 ["dqfoobar"]=> 133 string(20) "single quoted offset" 134 } 135 ["foo6"]=> 136 array(4) { 137 ["FUBAR_VARIABLE"]=> 138 string(8) "variable" 139 ["FUBAR_VARIABLE/foo"]=> 140 string(22) "variable with string 1" 141 ["foo/FUBAR_VARIABLE"]=> 142 string(22) "variable with string 2" 143 ["foo/FUBAR_VARIABLE/foo"]=> 144 string(22) "variable with string 3" 145 } 146 ["foo7"]=> 147 array(4) { 148 ["FUBAR_QUOTES_VARIABLE"]=> 149 string(17) "quoted variable 1" 150 ["FUBAR_QUOTES_VARIABLE/foo"]=> 151 string(17) "quoted variable 2" 152 ["foo/FUBAR_QUOTES_VARIABLE"]=> 153 string(17) "quoted variable 3" 154 ["foo/FUBAR_QUOTES_VARIABLE/foo"]=> 155 string(17) "quoted variable 4" 156 } 157 } 158 ["non value"]=> 159 array(4) { 160 ["novalue_option1"]=> 161 string(0) "" 162 ["novalue_option2"]=> 163 string(0) "" 164 ["novalue_option3"]=> 165 string(0) "" 166 ["novalue_option4"]=> 167 array(3) { 168 [0]=> 169 string(0) "" 170 [1]=> 171 string(0) "" 172 [2]=> 173 string(0) "" 174 } 175 } 176 ["Quoted strings and variables in sections"]=> 177 array(0) { 178 } 179 ["FUBAR_VARIABLE"]=> 180 array(0) { 181 } 182 ["FUBAR_VARIABLE/foo"]=> 183 array(0) { 184 } 185 ["foo/FUBAR_VARIABLE"]=> 186 array(0) { 187 } 188 ["foo/FUBAR_VARIABLE/foo"]=> 189 array(0) { 190 } 191 ["FUBAR_QUOTES_VARIABLE"]=> 192 array(0) { 193 } 194 ["FUBAR_QUOTES_VARIABLE/foo"]=> 195 array(0) { 196 } 197 ["foo/FUBAR_QUOTES_VARIABLE"]=> 198 array(0) { 199 } 200 ["foo/FUBAR_QUOTES_VARIABLE/foo"]=> 201 array(0) { 202 } 203 ["PATH=FUBAR_VARIABLE/no/quotes"]=> 204 array(0) { 205 } 206 ["PATH=FUBAR_VARIABLE/all/quoted"]=> 207 array(0) { 208 } 209 ["01"]=> 210 array(2) { 211 ["e"]=> 212 string(1) "e" 213 ["f"]=> 214 string(1) "f" 215 } 216 ["02"]=> 217 array(2) { 218 ["g"]=> 219 string(1) "g" 220 ["h"]=> 221 string(1) "h" 222 } 223 [1]=> 224 array(2) { 225 ["a"]=> 226 string(1) "a" 227 ["b"]=> 228 string(1) "b" 229 } 230 [2]=> 231 array(2) { 232 ["c"]=> 233 string(1) "c" 234 ["d"]=> 235 string(1) "d" 236 } 237 ["0815"]=> 238 array(1) { 239 ["bla"]=> 240 string(3) "bla" 241 } 242 ["bug #43923"]=> 243 array(3) { 244 ["curly1"]=> 245 string(1) "{" 246 ["curly2"]=> 247 string(1) "{" 248 ["curly3"]=> 249 string(1) "{" 250 } 251 ["bug #44019"]=> 252 array(6) { 253 ["concatenation_before"]=> 254 string(37) "this_is_test_constant+some_text_after" 255 ["concatenation_middle"]=> 256 string(54) "some_text_before+this_is_test_constant+some_text_after" 257 ["concatenation_after"]=> 258 string(38) "some_text_before+this_is_test_constant" 259 ["concatenation_nows_before"]=> 260 string(37) "this_is_test_constant+some_text_after" 261 ["concatenation_nows_middle"]=> 262 string(54) "some_text_before+this_is_test_constant+some_text_after" 263 ["concatenation_nows_after"]=> 264 string(38) "some_text_before+this_is_test_constant" 265 } 266 ["bug #43915"]=> 267 array(3) { 268 ["ini_with-hyphen"]=> 269 string(26) "with hyphen and underscore" 270 ["ini.with-hyphen"]=> 271 string(14) "dot and hyphen" 272 ["ini-with.hyphen"]=> 273 string(14) "hyphen and dot" 274 } 275 ["windows paths"]=> 276 array(2) { 277 ["winpath1"]=> 278 string(69) "c:\some windows\path\test\new\r\quote " here\single ' quote\some more" 279 ["winpath2"]=> 280 string(13) "special case\" 281 } 282} 283Done. 284