Make WordPress Core

Ticket #44563: 44563.3.diff

File 44563.3.diff, 1.6 KB (added by joemcgill, 6 years ago)
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index 6a30a598c3..32a39f002a 100644
    function wp_mkdir_p( $target ) { 
    18301830 * @return bool True if path is absolute, false is not absolute.
    18311831 */
    18321832function path_is_absolute( $path ) {
     1833        /*
     1834         * Check to see if the path is a stream and check to see if its an actual
     1835         * path or file as realpath() does not support stream wrappers.
     1836         */
     1837        if ( wp_is_stream( $path ) && ( is_dir( $path ) || is_file( $path ) ) ) {
     1838                return true;
     1839        }
     1840
    18331841        /*
    18341842         * This is definitive if true but fails if $path does not exist or contains
    18351843         * a symbolic link.
    function wp_delete_file( $file ) { 
    62696277 * @return bool True on success, false on failure.
    62706278 */
    62716279function wp_delete_file_from_directory( $file, $directory ) {
    6272         $real_file      = realpath( wp_normalize_path( $file ) );
    6273         $real_directory = realpath( wp_normalize_path( $directory ) );
     6280        if ( wp_is_stream( $file ) ) {
     6281                $real_file = wp_normalize_path( $file );
     6282                $real_directory = wp_normalize_path( $directory );
     6283        } else {
     6284                $real_file = realpath( wp_normalize_path( $file ) );
     6285                $real_directory = realpath ( wp_normalize_path( $directory ) );
     6286        }
    62746287
    6275         if ( false === $real_file || false === $real_directory || strpos( wp_normalize_path( $real_file ), trailingslashit( wp_normalize_path( $real_directory ) ) ) !== 0 ) {
     6288        if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) {
    62766289                return false;
    62776290        }
    62786291