From 996efe8f6e7f74d3fb40a71d31f74bec3ecfd6cb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 8 Mar 2018 19:32:30 +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. Built from https://develop.svn.wordpress.org/trunk@42801 git-svn-id: http://core.svn.wordpress.org/trunk@42631 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ba56521cf3..f013058d07 100644 --- a/wp-includes/functions.php +++ b/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 ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 5ce7e32bd5..3280d8590a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42800'; +$wp_version = '5.0-alpha-42801'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.