@@ -109,12 +109,16 @@ public function testFindWithOpenBaseDir()
109
109
$ this ->markTestSkipped ('Cannot test when open_basedir is set ' );
110
110
}
111
111
112
- $ this -> iniSet ('open_basedir ' , \dirname (\PHP_BINARY ).\PATH_SEPARATOR .'/ ' );
112
+ $ initialOpenBaseDir = ini_set ('open_basedir ' , \dirname (\PHP_BINARY ).\PATH_SEPARATOR .'/ ' );
113
113
114
- $ finder = new ExecutableFinder ();
115
- $ result = $ finder ->find ($ this ->getPhpBinaryName ());
114
+ try {
115
+ $ finder = new ExecutableFinder ();
116
+ $ result = $ finder ->find ($ this ->getPhpBinaryName ());
116
117
117
- $ this ->assertSamePath (\PHP_BINARY , $ result );
118
+ $ this ->assertSamePath (\PHP_BINARY , $ result );
119
+ } finally {
120
+ ini_set ('open_basedir ' , $ initialOpenBaseDir );
121
+ }
118
122
}
119
123
120
124
/**
@@ -130,12 +134,17 @@ public function testFindProcessInOpenBasedir()
130
134
}
131
135
132
136
$ this ->setPath ('' );
133
- $ this ->iniSet ('open_basedir ' , \PHP_BINARY .\PATH_SEPARATOR .'/ ' );
134
137
135
- $ finder = new ExecutableFinder ();
136
- $ result = $ finder ->find ($ this ->getPhpBinaryName (), false );
138
+ $ initialOpenBaseDir = ini_set ('open_basedir ' , \PHP_BINARY .\PATH_SEPARATOR .'/ ' );
137
139
138
- $ this ->assertSamePath (\PHP_BINARY , $ result );
140
+ try {
141
+ $ finder = new ExecutableFinder ();
142
+ $ result = $ finder ->find ($ this ->getPhpBinaryName (), false );
143
+
144
+ $ this ->assertSamePath (\PHP_BINARY , $ result );
145
+ } finally {
146
+ ini_set ('open_basedir ' , $ initialOpenBaseDir );
147
+ }
139
148
}
140
149
141
150
public function testFindBatchExecutableOnWindows ()
0 commit comments