From 18e83f9c3656991a03d3e8f6cfe5421003b9b847 Mon Sep 17 00:00:00 2001 From: dd32 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: http://core.svn.wordpress.org/trunk@21222 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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; } }