From 08aa0f52f982b73115181581b23df3ca2f92115f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 8 Mar 2018 19:45:41 +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. Merges [42801] to the 4.9 branch. Fixes #43417. Built from https://develop.svn.wordpress.org/branches/4.9@42804 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42634 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 da9f6326a1..ea03b56b8f 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1615,7 +1615,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 c13ccc9d0c..6190acf88b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.5-alpha-42803'; +$wp_version = '4.9.5-alpha-42804'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.