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
This commit is contained in:
Fabien Potencier 2015-02-16 10:13:40 +01:00
commit 3bbca21630
1 changed files with 2 additions and 2 deletions

View File

@ -72,8 +72,8 @@ class Filesystem
// 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);
}
}
}