From 641b92e43d7b7e0afa697f85dd95f67fb243c753 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 6 Jul 2012 11:19:46 +0000 Subject: [PATCH] WP_Filesystem: When recursivly searching for a directory path, only search for unfound directory entries. This solves a case where the same directory may be entered twice inadvertantly when nested directories using the same name exist. Fixes #20652 git-svn-id: https://develop.svn.wordpress.org/trunk@21222 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/class-wp-filesystem-base.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index 5fd46396af..0b12855b0e 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -211,7 +211,9 @@ class WP_Filesystem_Base { $newdir = trailingslashit(path_join($base, $key)); if ( $this->verbose ) printf( __('Changing to %s') . '
', $newdir ); - if ( $ret = $this->search_for_folder( $folder, $newdir, $loop) ) + // only search for the remaining path tokens in the directory, not the full path again + $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); + if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) ) return $ret; } }