Skip to content

Commit 427987e

Browse files
Merge branch '3.2' into 3.3
* 3.2: Don't display the Symfony debug toolbar when printing the page do not wire namespaces for the ArrayAdapter [Cache] Added test for ApcuAdapter when using in CLI allow to configure custom formats in XML configs [HttpKernel] fix DumpDataCollector tests [FrameworkBundle] fix changelog [WebProfilerBundle] Cleanup profiler leftover require the XML PHP extension Fix phpdoc for serializer normalizers exceptions Fixed absolute url generation for query strings and hash urls bumped Symfony version to 2.8.25 updated VERSION for 2.8.24 updated CHANGELOG for 2.8.24 bumped Symfony version to 2.7.32 [Filesystem] Dont copy perms when origin is remote updated VERSION for 2.7.31 update CONTRIBUTORS for 2.7.31 updated CHANGELOG for 2.7.31
2 parents 311fa71 + 61e0eb6 commit 427987e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Filesystem.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class Filesystem
3737
*/
3838
public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
3939
{
40-
if (stream_is_local($originFile) && !is_file($originFile)) {
40+
$originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
41+
if ($originIsLocal && !is_file($originFile)) {
4142
throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
4243
}
4344

@@ -68,11 +69,13 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
6869
throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
6970
}
7071

71-
// Like `cp`, preserve executable permission bits
72-
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
72+
if ($originIsLocal) {
73+
// Like `cp`, preserve executable permission bits
74+
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
7375

74-
if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
75-
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
76+
if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
77+
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
78+
}
7679
}
7780
}
7881
}

0 commit comments

Comments
 (0)