Make WordPress Core


Ignore:
Timestamp:
09/11/2013 08:26:57 AM (13 years ago)
Author:
dd32
Message:

Make use of the mbstring.func_overload helper functions in WP_Filesystem so byte lengths are properly determined. See #25259 Fixes #25237

File:
1 edited

Legend:

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

    r25305 r25349  
    9090                        return false;
    9191
     92                mbstring_binary_safe_encoding();
     93
    9294                if ( ! $this->ftp->fget($temphandle, $file) ) {
    9395                        fclose($temphandle);
    9496                        unlink($temp);
     97
     98                        reset_mbstring_encoding();
     99
    95100                        return ''; // Blank document, File does exist, It's just blank.
    96101                }
     102
     103                reset_mbstring_encoding();
    97104
    98105                fseek( $temphandle, 0 ); // Skip back to the start of the file being written to
    … …  
    118125                }
    119126
     127                // The FTP class uses string functions internally during file download/upload
     128                mbstring_binary_safe_encoding();
     129
    120130                $bytes_written = fwrite( $temphandle, $contents );
    121131                if ( false === $bytes_written || $bytes_written != strlen( $contents ) ) {
    122132                        fclose( $temphandle );
    123133                        unlink( $temp );
     134
     135                        reset_mbstring_encoding();
     136
    124137                        return false;
    125138                }
    … …  
    128141
    129142                $ret = $this->ftp->fput($file, $temphandle);
     143
     144                reset_mbstring_encoding();
    130145
    131146                fclose($temphandle);
    … …  
    294309                }
    295310
     311                mbstring_binary_safe_encoding();
     312
    296313                $list = $this->ftp->dirlist($path);
    297                 if ( empty($list) && !$this->exists($path) )
    298                         return false;
     314                if ( empty( $list ) && ! $this->exists( $path ) ) {
     315
     316                        reset_mbstring_encoding();
     317
     318                        return false;
     319                }
    299320
    300321                $ret = array();
    … …  
    323344                        $ret[ $struc['name'] ] = $struc;
    324345                }
     346
     347                reset_mbstring_encoding();
     348
    325349                return $ret;
    326350        }
Note: See TracChangeset for help on using the changeset viewer.