Skip to content

Commit

Permalink
Merge branch '6.3' into 6.4
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Sep 27, 2023
2 parents b947e42 + a1b31d8 commit 1591b45
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 38 deletions.
62 changes: 62 additions & 0 deletions Tests/FinderOpenBasedirTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Finder\Tests;

use Symfony\Component\Finder\Finder;

class FinderOpenBasedirTest extends Iterator\RealIteratorTestCase
{
/**
* @runInSeparateProcess
*/
public function testIgnoreVCSIgnoredWithOpenBasedir()
{
$this->markTestIncomplete('Test case needs to be refactored so that PHPUnit can run it');

if (\ini_get('open_basedir')) {
$this->markTestSkipped('Cannot test when open_basedir is set');
}

$finder = $this->buildFinder();
$this->assertSame(
$finder,
$finder
->ignoreVCS(true)
->ignoreDotFiles(true)
->ignoreVCSIgnored(true)
);

$this->iniSet('open_basedir', \dirname(__DIR__, 5).\PATH_SEPARATOR.self::toAbsolute('gitignore/search_root'));

$this->assertIterator(self::toAbsolute([
'gitignore/search_root/b.txt',
'gitignore/search_root/c.txt',
'gitignore/search_root/dir',
'gitignore/search_root/dir/a.txt',
'gitignore/search_root/dir/c.txt',
]), $finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
}

protected function buildFinder()
{
return Finder::create()->exclude('gitignore');
}

protected function iniSet(string $varName, string $newValue): void
{
if ('open_basedir' === $varName && $deprecationsFile = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
$newValue .= \PATH_SEPARATOR.$deprecationsFile;
}

parent::iniSet($varName, $newValue);
}
}
39 changes: 1 addition & 38 deletions Tests/FinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,35 +482,6 @@ public function testIgnoreVCSIgnoredUpToFirstGitRepositoryRoot()
]), $finder->in(self::toAbsolute('gitignore/git_root/search_root'))->getIterator());
}

/**
* @runInSeparateProcess
*/
public function testIgnoreVCSIgnoredWithOpenBasedir()
{
if (\ini_get('open_basedir')) {
$this->markTestSkipped('Cannot test when open_basedir is set');
}

$finder = $this->buildFinder();
$this->assertSame(
$finder,
$finder
->ignoreVCS(true)
->ignoreDotFiles(true)
->ignoreVCSIgnored(true)
);

$this->iniSet('open_basedir', \dirname(__DIR__, 5).\PATH_SEPARATOR.self::toAbsolute('gitignore/search_root'));

$this->assertIterator(self::toAbsolute([
'gitignore/search_root/b.txt',
'gitignore/search_root/c.txt',
'gitignore/search_root/dir',
'gitignore/search_root/dir/a.txt',
'gitignore/search_root/dir/c.txt',
]), $finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
}

public function testIgnoreVCSCanBeDisabledAfterFirstIteration()
{
$finder = $this->buildFinder();
Expand Down Expand Up @@ -1056,6 +1027,7 @@ public function testIn()
self::$tmpDir.\DIRECTORY_SEPARATOR.'Zephire.php',
self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php',
__DIR__.\DIRECTORY_SEPARATOR.'GitignoreTest.php',
__DIR__.\DIRECTORY_SEPARATOR.'FinderOpenBasedirTest.php',
__DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php',
__DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php',
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_0_1.php',
Expand Down Expand Up @@ -1624,13 +1596,4 @@ protected function buildFinder()
{
return Finder::create()->exclude('gitignore');
}

protected function iniSet(string $varName, string $newValue): void
{
if ('open_basedir' === $varName && $deprecationsFile = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
$newValue .= \PATH_SEPARATOR.$deprecationsFile;
}

parent::iniSet('open_basedir', $newValue);
}
}

0 comments on commit 1591b45

Please sign in to comment.