Commit da94a7d5 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Correction d'un gros bug dans UploadedFile->copyTo.

Showing with 3 additions and 2 deletions
+3 -2
......@@ -472,7 +472,7 @@ class UploadedFile implements UploadedFileInterface
* @param int $readOffset
* @return int
*/
public function copyTo($dest, $maxlen = PHP_INT_MAX, $readOffset = 0)
public function copyTo($dest, $maxlen = -1, $readOffset = 0)
{
if($maxlen === -1) {
$actualLength = $this->getSize() - $readOffset;
......@@ -480,7 +480,7 @@ class UploadedFile implements UploadedFileInterface
$actualLength = min($maxlen, $this->getSize() - $readOffset);
}
if (0 <= $actualLength) {
if ($actualLength <= 0) {
return 0;
}
......@@ -488,6 +488,7 @@ class UploadedFile implements UploadedFileInterface
$stream->open(new StreamMode('rb'));
$stream->seek($readOffset);
if(false !== $fileHandle = $stream->cast(STREAM_CAST_AS_STREAM)) {
// Utilise stream_copy_to_stream si le Stream nous renvoie un filehandle
$copied = $this->stream_copy_to_stream($fileHandle, $dest, $actualLength);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment