Normalize slashes in WP_Filesystem_MockFS::mkdir() and WP_Filesystem_MockFS::locate_parent_node() to avoid an infinite loop on Windows.

fixes #26091.

git-svn-id: https://develop.svn.wordpress.org/trunk@26246 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-11-18 15:32:47 +00:00
parent cf445be887
commit cbad0abaae
1 changed files with 4 additions and 2 deletions

View File

@ -81,7 +81,8 @@ class WP_Filesystem_MockFS extends WP_Filesystem_Base {
* Locates a filesystem node for the parent of the given item
*/
private function locate_parent_node( $path ) {
return $this->locate_node( trailingslashit( dirname( $path ) ) );
$dirname = str_replace( '\\', '/', dirname( $path ) );
return $this->locate_node( trailingslashit( $dirname ) );
}
// Here starteth the WP_Filesystem functions.
@ -91,7 +92,8 @@ class WP_Filesystem_MockFS extends WP_Filesystem_Base {
$parent_node = $this->locate_parent_node( $path );
if ( ! $parent_node ) {
$this->mkdir( dirname( $path ) );
$dirname = str_replace( '\\', '/', dirname( $path ) );
$this->mkdir( $dirname );
$parent_node = $this->locate_parent_node( $path );
if ( ! $parent_node )
return false;