mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-29 12:32:45 +00:00
SFTP: CS adjustments
This commit is contained in:
parent
b2ca37b990
commit
0a50932285
@ -895,10 +895,10 @@ class SFTP extends SSH2
|
|||||||
/**
|
/**
|
||||||
* Reads a list, be it detailed or not, of files in the given directory
|
* Reads a list, be it detailed or not, of files in the given directory
|
||||||
*
|
*
|
||||||
* @return array|false
|
* @return array|int|false array of files, integer status (if known) or false if something else is wrong
|
||||||
* @throws UnexpectedValueException on receipt of unexpected packets
|
* @throws UnexpectedValueException on receipt of unexpected packets
|
||||||
*/
|
*/
|
||||||
private function readlist(string $dir, bool $raw = true)
|
private function readlist(string $dir, bool $raw = true): array|int|false
|
||||||
{
|
{
|
||||||
if (!$this->precheck()) {
|
if (!$this->precheck()) {
|
||||||
return false;
|
return false;
|
||||||
@ -922,7 +922,7 @@ class SFTP extends SSH2
|
|||||||
break;
|
break;
|
||||||
case SFTPPacketType::STATUS:
|
case SFTPPacketType::STATUS:
|
||||||
// presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
// presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||||
list($status) = Strings::unpackSSH2('N', $response);
|
[$status] = Strings::unpackSSH2('N', $response);
|
||||||
$this->logError($response, $status);
|
$this->logError($response, $status);
|
||||||
return $status;
|
return $status;
|
||||||
default:
|
default:
|
||||||
@ -2325,7 +2325,7 @@ class SFTP extends SSH2
|
|||||||
$entries = $this->readlist($path, true);
|
$entries = $this->readlist($path, true);
|
||||||
|
|
||||||
// The folder does not exist at all, so we cannot delete it.
|
// The folder does not exist at all, so we cannot delete it.
|
||||||
if ($entries === NET_SFTP_STATUS_NO_SUCH_FILE) {
|
if ($entries === StatusCode::NO_SUCH_FILE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2663,6 +2663,9 @@ class SFTP extends SSH2
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
// if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||||
|
/**
|
||||||
|
* @var int $status
|
||||||
|
*/
|
||||||
[$status] = Strings::unpackSSH2('N', $response);
|
[$status] = Strings::unpackSSH2('N', $response);
|
||||||
if ($status != StatusCode::OK) {
|
if ($status != StatusCode::OK) {
|
||||||
$this->logError($response, $status);
|
$this->logError($response, $status);
|
||||||
|
Loading…
Reference in New Issue
Block a user