﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
20934	class-wp-filesystem-base::search_for_folder returns incorrect path	cgastrell	dd32	"== Intro ==
I got myself in an unusual situation, so this bug will oddly be duplicated. Worth a ticket though.

'''search_for_folder''' gets cut off in the wrong directory if a folder name is duplicated along the path. 

=== Example ===

 /var/www/domain/htdocs/wp_install::
   will work nice

 /var/www/domain/www/wp_install::
   will fail


=== Case ===
My situation is like this (in case i'm not being completely clear, pardon my english):

 live site path::
   /var/www/domain/www : working site
 test site path::
   /var/www/domain/test : working site installation duped and working
 path to ftp root::
   /var/www/

Every operation via ftp (automatic updates, plugin delete, theme install, plugin install) done on the '''test site''' falls on the directory of '''live site'''

When '''search_for_folder''' loops through the path parts (0=>var,1=>www,2=>domain,3=>www), as there are two path parts with the same name, it will be ''fouled'' into the first one. I don't know how else I could explain it, I'm not that good. Turning '''$this->verbose''' to ''true'' and adding '''print_r('key ' . $key .'<br />');''' at the begining of the foreach allowed me to understand how this was happening (will attach). My wp is in spanish, so, in the image, when it says 'Cambiando' means 'Changing to' and 'Encontrado' means 'Found' (verbose messages).

Hope somebody pick this and come up with some fixing."	defect (bug)	closed	normal	3.5	Filesystem	3.3.2	normal	fixed		
