8000 minor #13692 [Filesystem] Improve exception message for copy method (… · symfony/symfony@3bbca21 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3bbca21

Browse files
committed
minor #13692 [Filesystem] Improve exception message for copy method (King2500)
This PR was submitted for the 2.6 branch but it was merged into the 2.7 branch instead (closes #13692). Discussion ---------- [Filesystem] Improve exception message for copy method see diff | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes? (no change in semantics) | Fixed tickets | | License | MIT | Doc PR | Commits ------- 021206c [Filesystem] Improve exception message for copy method
2 parents 4c767e6 + 021206c commit 3bbca21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function copy($originFile, $targetFile, $override = false)
7272
// Like `cp`, preserve executable permission bits
7373
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
7474

75-
if (stream_is_local($originFile) && $bytesCopied !== filesize($originFile)) {
76-
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s %g bytes copied".', $originFile, $targetFile, $bytesCopied), 0, null, $originFile);
75+
if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
76+
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);
7777
}
7878
}
7979
}

0 commit comments

Comments
 (0)
0