1--TEST--
2Test parse_ini_file() function : variation: handling different boolean values
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--FILE--
6<?php
7/* Prototype  : array parse_ini_file(string filename [, bool process_sections])
8 * Description: Parse configuration file
9 * Source code: ext/standard/basic_functions.c
10 * Alias to functions:
11 */
12
13echo "*** Testing parse_ini_file() : variation ***\n";
14$output_file = __FILE__.".ini";
15$iniFile = <<<FILE
16[section1]
17value1=on
18value2=off
19[section2]
20value1=true
21value2=false
22[section3]
23value1=yes
24value2=no
25[section4]
26value1=null
27value2=
28
29[section5]
30value1="on"
31value2="off"
32[section6]
33value1="true"
34value2="false"
35[section7]
36value1="yes"
37value2="no"
38[section8]
39value1="null"
40value2=""
41
42FILE;
43
44file_put_contents($output_file, $iniFile);
45
46$a = parse_ini_file($output_file, true);
47var_dump($a);
48unlink($output_file);
49?>
50===DONE===
51--EXPECT--
52*** Testing parse_ini_file() : variation ***
53array(8) {
54  ["section1"]=>
55  array(2) {
56    ["value1"]=>
57    string(1) "1"
58    ["value2"]=>
59    string(0) ""
60  }
61  ["section2"]=>
62  array(2) {
63    ["value1"]=>
64    string(1) "1"
65    ["value2"]=>
66    string(0) ""
67  }
68  ["section3"]=>
69  array(2) {
70    ["value1"]=>
71    string(1) "1"
72    ["value2"]=>
73    string(0) ""
74  }
75  ["section4"]=>
76  array(2) {
77    ["value1"]=>
78    string(0) ""
79    ["value2"]=>
80    string(0) ""
81  }
82  ["section5"]=>
83  array(2) {
84    ["value1"]=>
85    string(2) "on"
86    ["value2"]=>
87    string(3) "off"
88  }
89  ["section6"]=>
90  array(2) {
91    ["value1"]=>
92    string(4) "true"
93    ["value2"]=>
94    string(5) "false"
95  }
96  ["section7"]=>
97  array(2) {
98    ["value1"]=>
99    string(3) "yes"
100    ["value2"]=>
101    string(2) "no"
102  }
103  ["section8"]=>
104  array(2) {
105    ["value1"]=>
106    string(4) "null"
107    ["value2"]=>
108    string(0) ""
109  }
110}
111===DONE===
112