Skip to content

Commit

Permalink
$progressCallback should be called after a specific amount of data ha…
Browse files Browse the repository at this point in the history
…s been received and not, if its just requested, as the requested packets might be more as the available and received data.
  • Loading branch information
thirsch authored and terrafrost committed Oct 31, 2020
1 parent 00c9edc commit b2ae60f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions phpseclib/Net/SFTP.php
Expand Up @@ -2309,9 +2309,6 @@ function get($remote_file, $local_file = false, $offset = 0, $length = -1, $prog
}
$packet = null;
$read+= $packet_size;
if (is_callable($progressCallback)) {
call_user_func($progressCallback, $read);
}
$i++;
}

Expand Down Expand Up @@ -2341,6 +2338,9 @@ function get($remote_file, $local_file = false, $offset = 0, $length = -1, $prog
} else {
fputs($fp, $temp);
}
if (is_callable($progressCallback)) {
call_user_func($progressCallback, $offset);
}
$temp = null;
break;
case NET_SFTP_STATUS:
Expand Down

1 comment on commit b2ae60f

@terrafrost
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1543

Please sign in to comment.