From 021206c0ac6ee7e73d4cf22d560e72fad5895d2a Mon Sep 17 00:00:00 2001 From: Thomas Schulz Date: Sat, 14 Feb 2015 22:36:49 +0100 Subject: [PATCH] [Filesystem] Improve exception message for copy method --- src/Symfony/Component/Filesystem/Filesystem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 251b333d8767..b0a0afa441da 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -72,8 +72,8 @@ public function copy($originFile, $targetFile, $override = false) // Like `cp`, preserve executable permission bits @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)); - if (stream_is_local($originFile) && $bytesCopied !== filesize($originFile)) { - throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s %g bytes copied".', $originFile, $targetFile, $bytesCopied), 0, null, $originFile); + if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) { + 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); } } }