Skip to content

Commit 733c8e4

Browse files
committed
Merge branch '5.2' into 5.3
* 5.2: [Filesystem] Workaround cannot dumpFile into "protected" folders on Windows Missing translations for Chinese (zh_CN) symfony#41814 update Italian translation added missing Arabic translations
2 parents 2888e40 + 0d8f6c2 commit 733c8e4

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

-8
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,6 @@ public function dumpFile(string $filename, $content)
669669
$this->mkdir($dir);
670670
}
671671

672-
if (!is_writable($dir)) {
673-
throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
674-
}
675-
676672
// Will create a temp file with 0600 access rights
677673
// when the filesystem supports chmod.
678674
$tmpFile = $this->tempnam($dir, basename($filename));
@@ -711,10 +707,6 @@ public function appendToFile(string $filename, $content)
711707
$this->mkdir($dir);
712708
}
713709

714-
if (!is_writable($dir)) {
715-
throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
716-
}
717-
718710
if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND)) {
719711
throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
720712
}

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

+21
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,27 @@ public function testCopyShouldKeepExecutionPermission()
17661766
$this->assertFilePermissions(767, $targetFilePath);
17671767
}
17681768

1769+
public function testDumpToProtectedDirectory()
1770+
{
1771+
if (\DIRECTORY_SEPARATOR !== '\\') {
1772+
$this->markTestSkipped('This test is specific to Windows.');
1773+
}
1774+
1775+
if (($userProfilePath = getenv('USERPROFILE')) === false || !is_dir($userProfilePath)) {
1776+
throw new \RuntimeException('Failed to retrieve user profile path.');
1777+
}
1778+
1779+
$targetPath = implode(\DIRECTORY_SEPARATOR, [$userProfilePath, 'Downloads', '__test_file.ext']);
1780+
1781+
try {
1782+
$this->assertFileDoesNotExist($targetPath);
1783+
$this->filesystem->dumpFile($targetPath, 'foobar');
1784+
$this->assertFileExists($targetPath);
1785+
} finally {
1786+
$this->filesystem->remove($targetPath);
1787+
}
1788+
}
1789+
17691790
/**
17701791
* Normalize the given path (transform each forward slash into a real directory separator).
17711792
*/

src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf

+4
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@
386386
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
387387
<target> صالح (ISIN) هذه القيمة ليست رقم تعريف الأوراق المالية الدولي.</target>
388388
</trans-unit>
389+
<trans-unit id="100">
390+
<source>This value should be a valid expression.</source>
391+
<target>يجب أن تكون هذه القيمة تعبيرًا صالحًا.</target>
392+
</trans-unit>
389393
</body>
390394
</file>
391395
</xliff>

src/Symfony/Component/Validator/Resources/translations/validators.it.xlf

+4
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@
386386
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
387387
<target>Questo valore non è un codice identificativo internazionale di valori mobiliari (ISIN) valido.</target>
388388
</trans-unit>
389+
<trans-unit id="100">
390+
<source>This value should be a valid expression.</source>
391+
<target>Questo valore dovrebbe essere un'espressione valida.</target>
392+
</trans-unit>
389393
</body>
390394
</file>
391395
</xliff>

src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf

+7-3
Original file line numberDiff line numberDiff line change
@@ -368,23 +368,27 @@
368368
</trans-unit>
369369
<trans-unit id="95">
370370
<source>This value is not a valid hostname.</source>
371-
<target>该数值不是有效的主机名称。</target>
371+
<target>该值不是有效的主机名称。</target>
372372
</trans-unit>
373373
<trans-unit id="96">
374374
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375375
<target>该集合内的元素数量得是 {{ compared_value }} 的倍数。</target>
376376
</trans-unit>
377377
<trans-unit id="97">
378378
<source>This value should satisfy at least one of the following constraints:</source>
379-
<target>该数值需符合以下其中一个约束:</target>
379+
<target>该值需符合以下其中一个约束:</target>
380380
</trans-unit>
381381
<trans-unit id="98">
382382
<source>Each element of this collection should satisfy its own set of constraints.</source>
383383
<target>该集合内的每个元素需符合元素本身规定的约束。</target>
384384
</trans-unit>
385385
<trans-unit id="99">
386386
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
387-
<target>该数值不是有效的国际证券识别码 (ISIN)。</target>
387+
<target>该值不是有效的国际证券识别码 (ISIN)。</target>
388+
</trans-unit>
389+
<trans-unit id="100">
390+
<source>This value should be a valid expression.</source>
391+
<target>该值需为一个有效的表达式。</target>
388392
</trans-unit>
389393
</body>
390394
</file>

0 commit comments

Comments
 (0)