Make WordPress Core

Ticket #44563: 44563.2.diff

File 44563.2.diff, 1.6 KB (added by mikeschroder, 4 years ago)

Refresh of patch and spacing.

  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index b00a47c1d8..c6bddaebda 100644
    function wp_mkdir_p( $target ) { 
    18161816 * @return bool True if path is absolute, false is not absolute.
    18171817 */
    18181818function path_is_absolute( $path ) {
     1819        /*
     1820         * Check to see if the path is a stream and check to see if its an actual
     1821         * path or file as realpath() does not support streamwrappers.
     1822         */
     1823        if ( wp_is_stream( $path ) && ( is_dir( $path ) || is_file ( $path ) ) ) {
     1824                return true;
     1825        }
     1826
    18191827        /*
    18201828         * This is definitive if true but fails if $path does not exist or contains
    18211829         * a symbolic link.
    function wp_delete_file( $file ) { 
    60056013 * @return bool True on success, false on failure.
    60066014 */
    60076015function wp_delete_file_from_directory( $file, $directory ) {
    6008         $real_file      = realpath( wp_normalize_path( $file ) );
    6009         $real_directory = realpath( wp_normalize_path( $directory ) );
     6016        if ( wp_is_stream($file) ) {
     6017                $real_file = wp_normalize_path( $file );
     6018                $real_directory = wp_normalize_path( $directory );
     6019        } else {
     6020                $real_file = realpath( wp_normalize_path( $file ) );
     6021                $real_directory = realpath ( wp_normalize_path( $directory ) );
     6022        }
    60106023
    6011         if ( false === $real_file || false === $real_directory || strpos( wp_normalize_path( $real_file ), trailingslashit( wp_normalize_path( $real_directory ) ) ) !== 0 ) {
     6024        if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) {
    60126025                return false;
    60136026        }
    60146027