File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
src/Symfony/Component/Finder/Tests Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -460,6 +460,9 @@ public function testIgnoreVCSIgnoredUpToFirstGitRepositoryRoot()
460
460
]), $ finder ->in (self ::toAbsolute ('gitignore/git_root/search_root ' ))->getIterator ());
461
461
}
462
462
463
+ /**
464
+ * @runInSeparateProcess
465
+ */
463
466
public function testIgnoreVCSIgnoredWithOpenBasedir ()
464
467
{
465
468
if (ini_get ('open_basedir ' )) {
@@ -1503,4 +1506,13 @@ protected function buildFinder()
1503
1506
{
1504
1507
return Finder::create ()->exclude ('gitignore ' );
1505
1508
}
1509
+
1510
+ protected function iniSet (string $ varName , string $ newValue ): void
1511
+ {
1512
+ if ('open_basedir ' === $ varName && $ deprecationsFile = getenv ('SYMFONY_DEPRECATIONS_SERIALIZE ' )) {
1513
+ $ newValue .= \PATH_SEPARATOR .$ deprecationsFile ;
1514
+ }
1515
+
1516
+ parent ::iniSet ('open_basedir ' , $ newValue );
1517
+ }
1506
1518
}
Original file line number Diff line number Diff line change @@ -90,10 +90,15 @@ public static function setUpBeforeClass(): void
90
90
91
91
public static function tearDownAfterClass (): void
92
92
{
93
- $ paths = new \RecursiveIteratorIterator (
94
- new \RecursiveDirectoryIterator (self ::$ tmpDir , \RecursiveDirectoryIterator::SKIP_DOTS ),
95
- \RecursiveIteratorIterator::CHILD_FIRST
96
- );
93
+ try {
94
+ $ paths = new \RecursiveIteratorIterator (
95
+ new \RecursiveDirectoryIterator (self ::$ tmpDir , \RecursiveDirectoryIterator::SKIP_DOTS ),
96
+ \RecursiveIteratorIterator::CHILD_FIRST
97
+ );
98
+ } catch (\UnexpectedValueException $ exception ) {
99
+ // open_basedir restriction in effect
100
+ return ;
101
+ }
97
102
98
103
foreach ($ paths as $ path ) {
99
104
if ($ path ->isDir ()) {
You can’t perform that action at this time.
0 commit comments