WordPress.org

Ready to get started?Download WordPress

Forums

Bug and bugfix in class-wp-filesystem-ssh2.php (1 post)

  1. tinodj
    Member
    Posted 5 years ago #

    replace
    return file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);

    with

    if (file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents)!==FALSE)
    return true;
    else
    return false;

    because if file is empty (0 bytes) it is not working. It returns 0, which later is considered to be false. So, do explicit check and return correct value. Check the documentation on file_put_contents.

Topic Closed

This topic has been closed to new replies.

About this Topic