Make WordPress Core

Changeset 37421


Ignore:
Timestamp:
05/12/2016 12:39:49 PM (8 years ago)
Author:
ocean90
Message:

Filesystem API: Don't add '.' to the list of directories which need to be checked/created when extracting a file.

Prevents a PHP warning by WP_Filesystem_Direct::mkdir() when installing a language pack which doesn't have subdirectories.

Props tfrommen.
Fixes #36570.

File:
1 edited

Legend:

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

    r37232 r37421  
    644644        $uncompressed_size += $info['size'];
    645645
    646         if ( '/' == substr($info['name'], -1) ) // directory
    647             $needed_dirs[] = $to . untrailingslashit($info['name']);
    648         else
    649             $needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
     646        if ( '/' === substr( $info['name'], -1 ) ) {
     647            // Directory.
     648            $needed_dirs[] = $to . untrailingslashit( $info['name'] );
     649        } elseif ( '.' !== $dirname = dirname( $info['name'] ) ) {
     650            // Path to a file.
     651            $needed_dirs[] = $to . untrailingslashit( $dirname );
     652        }
    650653    }
    651654
Note: See TracChangeset for help on using the changeset viewer.