SFTP: replace user_error() with Exceptions

This commit is contained in:
terrafrost 2019-05-28 08:52:53 -05:00
parent 72b4bf74d2
commit 79f925e43c

View File

@ -2468,8 +2468,8 @@ class SFTP extends SSH2
case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
return false; return false;
default: default:
user_error('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS'); throw new \UnexpectedValueException('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS. '
return false; . 'Got packet type: ' . $this->packet_type);
} }
} }
@ -2923,8 +2923,7 @@ class SFTP extends SSH2
// 256 * 1024 is what SFTP_MAX_MSG_LENGTH is set to in OpenSSH's sftp-common.h // 256 * 1024 is what SFTP_MAX_MSG_LENGTH is set to in OpenSSH's sftp-common.h
if ($tempLength > 256 * 1024) { if ($tempLength > 256 * 1024) {
user_error('Invalid SFTP packet size'); throw new \RuntimeException('Invalid Size');
return false;
} }
// SFTP packet type and data payload // SFTP packet type and data payload