Make WordPress Core


Ignore:
Timestamp:
07/06/2012 10:41:32 AM (11 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-base.php

    r19712 r21221  
    194194
    195195        $folder_parts = explode('/', $folder);
    196         $last_path = $folder_parts[ count($folder_parts) - 1 ];
     196        $last_index = array_pop( array_keys( $folder_parts ) );
     197        $last_path = $folder_parts[ $last_index ];
    197198
    198199        $files = $this->dirlist( $base );
    199200
    200         foreach ( $folder_parts as $key ) {
    201             if ( $key == $last_path )
     201        foreach ( $folder_parts as $index => $key ) {
     202            if ( $index == $last_index )
    202203                continue; //We want this to be caught by the next code block.
    203204
Note: See TracChangeset for help on using the changeset viewer.