1--TEST--
2Test parse_ini_file() function : variation: include path searching
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$pwd = getcwd();
15$f = "parse_ini_file_variation3";
16$dir1 = $pwd."/".$f.".dir1";
17$dir2 = $pwd."/".$f.".dir2";
18$dir3 = $pwd."/".$f.".dir3";
19$iniFile = "php.ini";
20
21$newdirs = array($dir1, $dir2, $dir3);
22$pathSep = ":";
23$newIncludePath = "";
24if(substr(PHP_OS, 0, 3) == 'WIN' ) {
25   $pathSep = ";";
26}
27foreach($newdirs as $newdir) {
28   mkdir($newdir);
29   $newIncludePath .= $newdir.$pathSep;
30}
31
32set_include_path($newIncludePath);
33$path = get_include_path();
34echo "New include path is : " . $path . "\n";
35
36$output_file = $dir2."/".$iniFile;
37$iniContent = <<<FILE
38error_reporting  =  E_ALL
39display_errors = On
40display_startup_errors = Off
41log_errors = Off
42log_errors_max_len = 1024
43ignore_repeated_errors = Off
44ignore_repeated_source = Off
45report_memleaks = On
46track_errors = Off
47docref_root = "/phpmanual/"
48docref_ext = .html
49
50FILE;
51
52file_put_contents($output_file, $iniContent);
53var_dump(parse_ini_file($iniFile));
54
55?>
56===Done===
57--CLEAN--
58<?php
59
60$pwd = getcwd();
61$f = "parse_ini_file_variation3";
62$iniFile = "php.ini";
63
64$dir1 = $pwd."/".$f.".dir1";
65$dir2 = $pwd."/".$f.".dir2";
66$dir3 = $pwd."/".$f.".dir3";
67$newdirs = array($dir1, $dir2, $dir3);
68$output_file = $dir2."/".$iniFile;
69
70// Tidy up after test
71unlink($output_file);
72foreach($newdirs as $newdir) {
73   rmdir($newdir);
74}
75
76?>
77--EXPECTF--
78*** Testing parse_ini_file() : variation ***
79New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S
80array(11) {
81  ["error_reporting"]=>
82  string(5) "32767"
83  ["display_errors"]=>
84  string(1) "1"
85  ["display_startup_errors"]=>
86  string(0) ""
87  ["log_errors"]=>
88  string(0) ""
89  ["log_errors_max_len"]=>
90  string(4) "1024"
91  ["ignore_repeated_errors"]=>
92  string(0) ""
93  ["ignore_repeated_source"]=>
94  string(0) ""
95  ["report_memleaks"]=>
96  string(1) "1"
97  ["track_errors"]=>
98  string(0) ""
99  ["docref_root"]=>
100  string(11) "/phpmanual/"
101  ["docref_ext"]=>
102  string(5) ".html"
103}
104===Done===
105