@@ -35,28 +35,29 @@ public function testIgnoreVCSIgnoredWithOpenBasedir()
35
35
->ignoreVCSIgnored (true )
36
36
);
37
37
38
- $ this ->iniSet ('open_basedir ' , \dirname (__DIR__ , 5 ).\PATH_SEPARATOR .self ::toAbsolute ('gitignore/search_root ' ));
39
-
40
- $ this ->assertIterator (self ::toAbsolute ([
41
- 'gitignore/search_root/b.txt ' ,
42
- 'gitignore/search_root/c.txt ' ,
43
- 'gitignore/search_root/dir ' ,
44
- 'gitignore/search_root/dir/a.txt ' ,
45
- 'gitignore/search_root/dir/c.txt ' ,
46
- ]), $ finder ->in (self ::toAbsolute ('gitignore/search_root ' ))->getIterator ());
38
+ $ openBaseDir = \dirname (__DIR__ , 5 ).\PATH_SEPARATOR .self ::toAbsolute ('gitignore/search_root ' );
39
+
40
+ if ($ deprecationsFile = getenv ('SYMFONY_DEPRECATIONS_SERIALIZE ' )) {
41
+ $ openBaseDir .= \PATH_SEPARATOR .$ deprecationsFile ;
42
+ }
43
+
44
+ $ oldOpenBaseDir = ini_set ('open_basedir ' , $ openBaseDir );
45
+
46
+ try {
47
+ $ this ->assertIterator (self ::toAbsolute ([
48
+ 'gitignore/search_root/b.txt ' ,
49
+ 'gitignore/search_root/c.txt ' ,
50
+ 'gitignore/search_root/dir ' ,
51
+ 'gitignore/search_root/dir/a.txt ' ,
52
+ 'gitignore/search_root/dir/c.txt ' ,
53
+ ]), $ finder ->in (self ::toAbsolute ('gitignore/search_root ' ))->getIterator ());
54
+ } finally {
55
+ ini_set ('open_basedir ' , $ oldOpenBaseDir );
56
+ }
47
57
}
48
58
49
59
protected function buildFinder ()
50
60
{
51
61
return Finder::create ()->exclude ('gitignore ' );
52
62
}
53
-
54
- protected function iniSet (string $ varName , string $ newValue ): void
55
- {
56
- if ('open_basedir ' === $ varName && $ deprecationsFile = getenv ('SYMFONY_DEPRECATIONS_SERIALIZE ' )) {
57
- $ newValue .= \PATH_SEPARATOR .$ deprecationsFile ;
58
- }
59
-
60
- parent ::iniSet ($ varName , $ newValue );
61
- }
62
63
}
0 commit comments