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
36ignore_repeated_errors = Off
37ignore_repeated_source = Off
38report_memleaks = On
39docref_root = "/phpmanual/"
40docref_ext = .html
41
42FILE;
43
44file_put_contents($output_file, $iniContent);
45var_dump(parse_ini_file($iniFile));
46
47?>
48--CLEAN--
49<?php
50
51$pwd = getcwd();
52$f = "parse_ini_file_variation3";
53$iniFile = "php.ini";
54
55$dir1 = $pwd."/".$f.".dir1";
56$dir2 = $pwd."/".$f.".dir2";
57$dir3 = $pwd."/".$f.".dir3";
58$newdirs = array($dir1, $dir2, $dir3);
59$output_file = $dir2."/".$iniFile;
60
61// Tidy up after test
62unlink($output_file);
63foreach($newdirs as $newdir) {
64   rmdir($newdir);
65}
66
67?>
68--EXPECTF--
69*** Testing parse_ini_file() : variation ***
70New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S
71array(9) {
72  ["error_reporting"]=>
73  string(5) "32767"
74  ["display_errors"]=>
75  string(1) "1"
76  ["display_startup_errors"]=>
77  string(0) ""
78  ["log_errors"]=>
79  string(0) ""
80  ["ignore_repeated_errors"]=>
81  string(0) ""
82  ["ignore_repeated_source"]=>
83  string(0) ""
84  ["report_memleaks"]=>
85  string(1) "1"
86  ["docref_root"]=>
87  string(11) "/phpmanual/"
88  ["docref_ext"]=>
89  string(5) ".html"
90}
91