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