WordPress.org

Make WordPress Core

Ticket #47185: 47185.diff

File 47185.diff, 980 bytes (added by SergeyBiryukov, 22 months ago)
  • src/wp-includes/functions.php

     
    62826282 */
    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 ) );
    62906290        }
    62916291
     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 );
     6298        }
     6299
    62926300        if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) {
    62936301                return false;
    62946302        }