WP_Filesystem: Correct a rare case where the FTP directory will be detected incorrectly when the final path token exists higher in the chain, for example /x/x/Z/x/Z/ would be detected as /x/x/Z/. Fixes #20934

git-svn-id: https://develop.svn.wordpress.org/trunk@21221 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2012-07-06 10:41:32 +00:00
parent 0d795fe1d1
commit a30fde5be4
@@ -193,12 +193,13 @@ class WP_Filesystem_Base {
$folder = untrailingslashit($folder);
$folder_parts = explode('/', $folder);
$last_path = $folder_parts[ count($folder_parts) - 1 ];
$last_index = array_pop( array_keys( $folder_parts ) );
$last_path = $folder_parts[ $last_index ];
$files = $this->dirlist( $base );
foreach ( $folder_parts as $key ) {
if ( $key == $last_path )
foreach ( $folder_parts as $index => $key ) {
if ( $index == $last_index )
continue; //We want this to be caught by the next code block.
//Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,