WordPress.org

Make WordPress Core

Changeset 36628


Ignore:
Timestamp:
02/23/2016 03:57:23 PM (5 years ago)
Author:
azaozz
Message:

In wp_upload_dir() do not cache error from wp_mkdir_p() when a directory cannot be created. Keep trying to create the dirs. This happens mostly in file upload context.

See #34359.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r36569 r36628  
    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 ) ) {
     
    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    }
Note: See TracChangeset for help on using the changeset viewer.