@@ -109,12 +109,16 @@ public function testFindWithOpenBaseDir()
109109 $ this ->markTestSkipped ('Cannot test when open_basedir is set ' );
110110 }
111111
112- $ this -> iniSet ('open_basedir ' , \dirname (\PHP_BINARY ).\PATH_SEPARATOR .'/ ' );
112+ $ initialOpenBaseDir = ini_set ('open_basedir ' , \dirname (\PHP_BINARY ).\PATH_SEPARATOR .'/ ' );
113113
114- $ finder = new ExecutableFinder ();
115- $ result = $ finder ->find ($ this ->getPhpBinaryName ());
114+ try {
115+ $ finder = new ExecutableFinder ();
116+ $ result = $ finder ->find ($ this ->getPhpBinaryName ());
116117
117- $ this ->assertSamePath (\PHP_BINARY , $ result );
118+ $ this ->assertSamePath (\PHP_BINARY , $ result );
119+ } finally {
120+ ini_set ('open_basedir ' , $ initialOpenBaseDir );
121+ }
118122 }
119123
120124 /**
@@ -130,12 +134,17 @@ public function testFindProcessInOpenBasedir()
130134 }
131135
132136 $ this ->setPath ('' );
133- $ this ->iniSet ('open_basedir ' , \PHP_BINARY .\PATH_SEPARATOR .'/ ' );
134137
135- $ finder = new ExecutableFinder ();
136- $ result = $ finder ->find ($ this ->getPhpBinaryName (), false );
138+ $ initialOpenBaseDir = ini_set ('open_basedir ' , \PHP_BINARY .\PATH_SEPARATOR .'/ ' );
137139
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+ }
139148 }
140149
141150 public function testFindBatchExecutableOnWindows ()
0 commit comments