From 954eeba0537fa044d068181c2dfcf5d9ab15b0be Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Thu, 12 May 2016 12:39:49 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@37421 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/file.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index e527b2eb97..5abb4cfba5 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -643,10 +643,13 @@ function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) { $uncompressed_size += $info['size']; - if ( '/' == substr($info['name'], -1) ) // directory - $needed_dirs[] = $to . untrailingslashit($info['name']); - else - $needed_dirs[] = $to . untrailingslashit(dirname($info['name'])); + if ( '/' === substr( $info['name'], -1 ) ) { + // Directory. + $needed_dirs[] = $to . untrailingslashit( $info['name'] ); + } elseif ( '.' !== $dirname = dirname( $info['name'] ) ) { + // Path to a file. + $needed_dirs[] = $to . untrailingslashit( $dirname ); + } } /*