From 19ed786c78805ad7adf48438e93d90cfa999f0b8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 8 Mar 2018 19:31:59 +0000 Subject: [PATCH] Filesystem API: Avoid an infinite loop in `wp_mkdir_p()` when trying to determine the parent folder with `open_basedir` restriction in effect. Props soulseekah, 1265578519-1. Fixes #43417. git-svn-id: https://develop.svn.wordpress.org/trunk@42801 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index ba56521cf3..f013058d07 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -1679,7 +1679,7 @@ function wp_mkdir_p( $target ) { // We need to find the permissions of the parent folder that exists and inherit that. $target_parent = dirname( $target ); - while ( '.' != $target_parent && ! is_dir( $target_parent ) ) { + while ( '.' != $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) { $target_parent = dirname( $target_parent ); }