Make WordPress Core


Ignore:
Timestamp:
07/18/2016 07:42:48 PM (8 years ago)
Author:
ocean90
Message:

Filesystem API: Cleanup temporary file when the temporary file couldn't be opened.

Props ruud@joyo.
See #34772.
Fixes #36942, #36943.

File:
1 edited

Legend:

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

    r35944 r38094  
    122122        $temp = wp_tempnam( $file );
    123123
    124         if ( ! $temphandle = fopen($temp, 'w+') )
    125             return false;
     124        if ( ! $temphandle = fopen( $temp, 'w+' ) ) {
     125            unlink( $temp );
     126            return false;
     127        }
    126128
    127129        mbstring_binary_safe_encoding();
Note: See TracChangeset for help on using the changeset viewer.