10000 Merge branch '5.4' into 6.4 · symfony/symfony@39d989a · GitHub
[go: up one dir, main page]

Skip to content

Commit 39d989a

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: [FrameworkBundle] fixes #54402: Suppress PHP warning when is_readable() tries to access dirs outside of open_basedir restrictions return null when message with name is not set use local PHP web server to test HTTP stream wrappers Bump Symfony version to 5.4.39 Update VERSION for 5.4.38 Update CONTRIBUTORS for 5.4.38 Update CHANGELOG for 5.4.38
2 parents ff77282 + e9a7cb9 commit 39d989a

File tree

8 files changed

+100
-61
lines changed

8 files changed

+100
-61
lines changed

CONTRIBUTORS.md

Lines changed: 45 additions & 29 deletions
Large diffs are not rendered by default.

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function isNfs(string $dir): bool
200200

201201
if (null === $mounts) {
202202
$mounts = [];
203-
if ('/' === \DIRECTORY_SEPARATOR && is_readable('/proc/mounts') && $files = @file('/proc/mounts')) {
203+
if ('/' === \DIRECTORY_SEPARATOR && @is_readable('/proc/mounts') && $files = @file('/proc/mounts')) {
204204
foreach ($files as $mount) {
205205
$mount = \array_slice(explode(' ', $mount), 1, -3);
206206
if (!\in_array(array_pop($mount), ['vboxsf', 'nfs'])) {

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,4 +1267,11 @@ public function testMultiLineFormatIsFullyCorrectlyWithManuallyCleanup()
12671267
stream_get_contents($output->getStream())
12681268
);
12691269
}
1270+
1271+
public function testGetNotSetMessage()
1272+
{
1273+
$progressBar = new ProgressBar($this->getOutputStream());
1274+
1275+
$this->assertNull($progressBar->getMessage());
1276+
}
12701277
}

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
1515
use Symfony\Component\Filesystem\Exception\IOException;
1616
use Symfony\Component\Filesystem\Path;
17+
use Symfony\Component\Process\PhpExecutableFinder;
18+
use Symfony\Component\Process\Process;
1719

1820
/**
1921
* Test class for Filesystem.
@@ -162,23 +164,32 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist()
162164
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
163165
}
164166

165-
/**
166-
* @group network
167-
*/
168167
public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy()
169168
{
170-
if (!\in_array('https', stream_get_wrappers())) {
171-
$this->markTestSkipped('"https" stream wrapper is not enabled.');
169+
if (!\in_array('http', stream_get_wrappers())) {
170+
$this->markTestSkipped('"http" stream wrapper is not enabled.');
172171
}
173-
$sourceFilePath = 'https://symfony.com/images/common/logo/logo_symfony_header.png';
174-
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
175172

176-
file_put_contents($targetFilePath, 'TARGET FILE');
173+
$finder = new PhpExecutableFinder();
174+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
175+
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
177176

178-
$this->filesystem->copy($sourceFilePath, $targetFilePath, false);
177+
$process->start();
179178

180-
$this->assertFileExists($targetFilePath);
181-
$this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath));
179+
do {
180+
usleep(50000);
181+
} while (!@fopen('http://127.0.0.1:8057', 'r'));
182+
183+
try {
184+
$sourceFilePath = 'http://localhost:8057/logo_symfony_header.png';
185+
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
186+
file_put_contents($targetFilePath, 'TARGET FILE');
187+
$this->filesystem->copy($sourceFilePath, $targetFilePath, false);
188+
$this->assertFileExists($targetFilePath);
189+
$this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath));
190+
} finally {
191+
$process->stop();
192+
}
182193
}
183194

184195
public function testMkdirCreatesDirectoriesRecursively()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php
Loading

src/Symfony/Component/Filesystem/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require": {
1919
"php": ">=8.1",
2020
"symfony/polyfill-ctype": "~1.8",
21-
"symfony/polyfill-mbstring": "~1.8"
21+
"symfony/polyfill-mbstring": "~1.8",
22+
"symfony/process": "^5.4|^6.4"
2223
},
2324
"autoload": {
2425
"psr-4": { "Symfony\\Component\\Filesystem\\": "" },

src/Symfony/Component/Mime/Tests/Part/DataPartTest.php

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,32 +138,35 @@ public function testFromPathWithNotAFile()
138138

139139
public function testFromPathWithUrl()
140140
{
141-
if (!\in_array('https', stream_get_wrappers())) {
142-
$this->markTestSkipped('"https" stream wrapper is not enabled.');
141+
if (!\in_array('http', stream_get_wrappers())) {
142+
$this->markTestSkipped('"http" stream wrapper is not enabled.');
143143
}
144144

145145
$finder = new PhpExecutableFinder();
146146
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
147147
$process->setWorkingDirectory(__DIR__.'/../Fixtures/web');
148148
$process->start();
149149

150-
do {
151-
usleep(50000);
152-
} while (!@fopen('http://127.0.0.1:8057', 'r'));
153-
154-
$p = DataPart::fromPath($file = 'http://localhost:8057/logo_symfony_header.png');
155-
$content = file_get_contents($file);
156-
$this->assertEquals($content, $p->getBody());
157-
$maxLineLength = 76;
158-
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr($p->bodyToString(), 0, $maxLineLength));
159-
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr(implode('', iterator_to_array($p->bodyToIterable())), 0, $maxLineLength));
160-
$this->assertEquals('image', $p->getMediaType());
161-
$this->assertEquals('png', $p->getMediaSubType());
162-
$this->assertEquals(new Headers(
163-
new ParameterizedHeader('Content-Type', 'image/png', ['name' => 'logo_symfony_header.png']),
164-
new UnstructuredHeader('Content-Transfer-Encoding', 'base64'),
165-
new ParameterizedHeader('Content-Disposition', 'attachment', ['name' => 'logo_symfony_header.png', 'filename' => 'logo_symfony_header.png'])
166-
), $p->getPreparedHeaders());
150+
try {
151+
do {
152+
usleep(50000);
153+
} while (!@fopen('http://127.0.0.1:8057', 'r'));
154+
$p = DataPart::fromPath($file = 'http://localhost:8057/logo_symfony_header.png');
155+
$content = file_get_contents($file);
156+
$this->assertEquals($content, $p->getBody());
157+
$maxLineLength = 76;
158+
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr($p->bodyToString(), 0, $maxLineLength));
159+
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr(implode('', iterator_to_array($p->bodyToIterable())), 0, $maxLineLength));
160+
$this->assertEquals('image', $p->getMediaType());
161+
$this->assertEquals('png', $p->getMediaSubType());
162+
$this->assertEquals(new Headers(
163+
new ParameterizedHeader('Content-Type', 'image/png', ['name' => 'logo_symfony_header.png']),
164+
new UnstructuredHeader('Content-Transfer-Encoding', 'base64'),
165+
new ParameterizedHeader('Content-Disposition', 'attachment', ['name' => 'logo_symfony_header.png', 'filename' => 'logo_symfony_header.png'])
166+
), $p->getPreparedHeaders());
167+
} finally {
168+
$process->stop();
169+
}
167170
}
168171

169172
public function testHasContentId()

0 commit comments

Comments
 (0)
0