WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/09/2013 02:42:52 AM (7 years ago)
Author:
dd32
Message:

WP_Filesystem: Ensure that all files are read/written correctly by verifying the return values from fwrite() and using FTP_BINARY mode (ASCII converts line endings as per the spec). See #25237

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php

    r24626 r25304  
    151151    }
    152152
    153     function get_contents($file, $type = '', $resumepos = 0 ) {
     153    function get_contents( $file ) {
    154154        $file = ltrim($file, '/');
    155155        return file_get_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file);
     
    165165        $ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
    166166
     167        if ( $ret !== strlen( $contents ) )
     168            return false;
     169
    167170        $this->chmod($file, $mode);
    168171
    169         return false !== $ret;
     172        return true;
    170173    }
    171174
Note: See TracChangeset for help on using the changeset viewer.