Skip to content

Commit 1591b45

Browse files
Merge branch '6.3' into 6.4
* 6.3: [Cache] Fix Redis6Proxy [Finder] Disable failing test about open_basedir Fix merge Fix merge [Notifier] Telegram Bridge add escaping for \ [Routing] Fix routing collection defaults when adding a new route to a collection [Messenger] Fix cloned TraceableStack not unstacking the stack independently [DependencyInjection] Fix autocasting null env values to empty string with container.env_var_processors_locator [Cache] Fix support for Redis Sentinel using php-redis 6.0.0 [Notifier] Fix Smsmode HttpClient mandatory headers minor #51693 Disable the dead code analysis in Psalm (stof) Update the PR template [SecurityBundle][PasswordHasher] Fix password migration with custom hasher service with security bundle config [Translator] Fix support for `default_path` in XML [FrameworkBundle] Handle tags array attributes in descriptors [HttpClient] Fix TraceableResponse if response has no destruct method [FrameworkBundle] Always use buildDir as `ConfigBuilderGenerator` outputDir
2 parents b947e42 + a1b31d8 commit 1591b45

File tree

2 files changed

+63
-38
lines changed

2 files changed

+63
-38
lines changed

Tests/FinderOpenBasedirTest.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Finder\Tests;
13+
14+
use Symfony\Component\Finder\Finder;
15+
16+
class FinderOpenBasedirTest extends Iterator\RealIteratorTestCase
17+
{
18+
/**
19+
* @runInSeparateProcess
20+
*/
21+
public function testIgnoreVCSIgnoredWithOpenBasedir()
22+
{
23+
$this->markTestIncomplete('Test case needs to be refactored so that PHPUnit can run it');
24+
25+
if (\ini_get('open_basedir')) {
26+
$this->markTestSkipped('Cannot test when open_basedir is set');
27+
}
28+
29+
$finder = $this->buildFinder();
30+
$this->assertSame(
31+
$finder,
32+
$finder
33+
->ignoreVCS(true)
34+
->ignoreDotFiles(true)
35+
->ignoreVCSIgnored(true)
36+
);
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());
47+
}
48+
49+
protected function buildFinder()
50+
{
51+
return Finder::create()->exclude('gitignore');
52+
}
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+
}

Tests/FinderTest.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -482,35 +482,6 @@ public function testIgnoreVCSIgnoredUpToFirstGitRepositoryRoot()
482482
]), $finder->in(self::toAbsolute('gitignore/git_root/search_root'))->getIterator());
483483
}
484484

485-
/**
486-
* @runInSeparateProcess
487-
*/
488-
public function testIgnoreVCSIgnoredWithOpenBasedir()
489-
{
490-
if (\ini_get('open_basedir')) {
491-
$this->markTestSkipped('Cannot test when open_basedir is set');
492-
}
493-
494-
$finder = $this->buildFinder();
495-
$this->assertSame(
496-
$finder,
497-
$finder
498-
->ignoreVCS(true)
499-
->ignoreDotFiles(true)
500-
->ignoreVCSIgnored(true)
501-
);
502-
503-
$this->iniSet('open_basedir', \dirname(__DIR__, 5).\PATH_SEPARATOR.self::toAbsolute('gitignore/search_root'));
504-
505-
$this->assertIterator(self::toAbsolute([
506-
'gitignore/search_root/b.txt',
507-
'gitignore/search_root/c.txt',
508-
'gitignore/search_root/dir',
509-
'gitignore/search_root/dir/a.txt',
510-
'gitignore/search_root/dir/c.txt',
511-
]), $finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
512-
}
513-
514485
public function testIgnoreVCSCanBeDisabledAfterFirstIteration()
515486
{
516487
$finder = $this->buildFinder();
@@ -1056,6 +1027,7 @@ public function testIn()
10561027
self::$tmpDir.\DIRECTORY_SEPARATOR.'Zephire.php',
10571028
self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php',
10581029
__DIR__.\DIRECTORY_SEPARATOR.'GitignoreTest.php',
1030+
__DIR__.\DIRECTORY_SEPARATOR.'FinderOpenBasedirTest.php',
10591031
__DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php',
10601032
__DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php',
10611033
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_0_1.php',
@@ -1624,13 +1596,4 @@ protected function buildFinder()
16241596
{
16251597
return Finder::create()->exclude('gitignore');
16261598
}
1627-
1628-
protected function iniSet(string $varName, string $newValue): void
1629-
{
1630-
if ('open_basedir' === $varName && $deprecationsFile = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
1631-
$newValue .= \PATH_SEPARATOR.$deprecationsFile;
1632-
}
1633-
1634-
parent::iniSet('open_basedir', $newValue);
1635-
}
16361599
}

0 commit comments

Comments
 (0)