Make WordPress Core

Ticket #34359: 34359.6.patch

File 34359.6.patch, 1.0 KB (added by azaozz, 7 years ago)
  • src/wp-includes/functions.php

     
    18751875                        $tested_paths = array();
    18761876                }
    18771877
    1878                 if ( array_key_exists( $path, $tested_paths ) ) {
    1879                         $uploads['error'] = $tested_paths[ $path ];
    1880                 } else {
     1878                if ( ! in_array( $path, $tested_paths, true ) ) {
    18811879                        if ( ! wp_mkdir_p( $path ) ) {
    18821880                                if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
    18831881                                        $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
     
    18861884                                }
    18871885
    18881886                                $uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) );
     1887                        } else {
     1888                                $tested_paths[] = $path;
     1889                                wp_cache_set( 'upload_dir_tested_paths', $tested_paths );
    18891890                        }
    1890 
    1891                         $tested_paths[ $path ] = $uploads['error'];
    1892                         wp_cache_set( 'upload_dir_tested_paths', $tested_paths );
    18931891                }
    18941892        }
    18951893