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:
commit
3bbca21630
@ -72,8 +72,8 @@ class Filesystem
|
|||||||
// Like `cp`, preserve executable permission bits
|
// Like `cp`, preserve executable permission bits
|
||||||
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
|
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
|
||||||
|
|
||||||
if (stream_is_local($originFile) && $bytesCopied !== filesize($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 bytes copied".', $originFile, $targetFile, $bytesCopied), 0, null, $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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user