Make WordPress Core

Changeset 45353 for branches/5.2


Ignore:
Timestamp:
05/17/2019 01:30:15 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Media: Fix deletion of files on Windows.

wp_delete_file_from_directory() should always normalize file paths before comparing.

Props tonybogdanov, SergeyBiryukov.
Merges [45352] to the 5.2 branch.
Fixes #47185.

Location:
branches/5.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

  • branches/5.2/src/wp-includes/functions.php

    r45249 r45353  
    62836283function wp_delete_file_from_directory( $file, $directory ) {
    62846284        if ( wp_is_stream( $file ) ) {
    6285                 $real_file      = wp_normalize_path( $file );
    6286                 $real_directory = wp_normalize_path( $directory );
     6285                $real_file      = $file;
     6286                $real_directory = $directory;
    62876287        } else {
    62886288                $real_file      = realpath( wp_normalize_path( $file ) );
    62896289                $real_directory = realpath( wp_normalize_path( $directory ) );
     6290        }
     6291
     6292        if ( false !== $real_file ) {
     6293                $real_file = wp_normalize_path( $real_file );
     6294        }
     6295
     6296        if ( false !== $real_directory ) {
     6297                $real_directory = wp_normalize_path( $real_directory );
    62906298        }
    62916299
Note: See TracChangeset for help on using the changeset viewer.