为什么 phpseclib sftp returns "The directory '%s' does not exist and could not be created (%s)."?

Why phpseclibsftp returns "The directory '%s' does not exist and could not be created (%s)."?

调用时

$fileSystem = $this->filesystemMap->get(IMReporter::FILE_SYSTEM_SFTP_NAME);
$fileSystem->write($filename, file_get_contents($tempFile));

我得到目录“/home/darius/Desktop/veracitytest”不存在且无法创建 ()。

我已经创建了目录并手动将权限设置为 777。调试时我看到它调用

protected function ensureDirectoryExists($directory, $create)
{
    $pwd = $this->sftp->pwd();
    if ($this->sftp->chdir($directory)) {
        $this->sftp->chdir($pwd);
    } elseif ($create) {
        if (!$this->sftp->mkdir($directory, 0777, true)) {
            throw new \RuntimeException(sprintf('The directory \'%s\' does not exist and could not be created (%s).', $this->directory, $this->sftp->getLastSFTPError()));
        }
    } else {
        throw new \RuntimeException(sprintf('The directory \'%s\' does not exist.', $this->directory));
    }
}

它调用 !$this->sftp->mkdir($directory, 0777, true)

在mkdir中有这样的代码

if (!($this->bitmap & SSH2::MASK_LOGIN)) {
    return false;
}

which returns false 所以我得到了错误。

$this->bitmap 是 7。我不明白它在这里试图做什么。在lib中有这样的评论:

 /**
     * Execution Bitmap
     *
     * The bits that are set represent functions that have been called already.  This is used to determine
     * if a requisite function has been successfully executed.  If not, an error should be thrown.
     *
     * @var int
     * @access private
     */
var $bitmap = 0;

到目前为止我还没有找到它在哪里设置为 7。

使用 https://github.com/phpseclib/phpseclib 2.0

找到答案 - 我在输入错误密码时收到此消息。