Commit 3fbf758a28 for wordpress.org
commit 3fbf758a288a1cafaae732a133f69195a5a1939d
Author: lancewillett <lancewillett@git.wordpress.org>
Date: Sun Nov 1 17:40:35 2026 +0000
Filesystem: Handle concurrent directory creation in `wp_mkdir_p()`.
Accept a directory created by another process after `mkdir()` fails, without changing its permissions. Add coverage for directory creation, existing paths, traversal rejection, and the race fallback.
Developed in: https://github.com/WordPress/wordpress-develop/pull/15033
Props pbearne, wildworks, dhrupo.
See #57081.
Built from https://develop.svn.wordpress.org/trunk@65175
git-svn-id: http://core.svn.wordpress.org/trunk@64324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 0745f0b891..d021b635ed 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -2137,7 +2137,11 @@ function wp_mkdir_p( $target ) {
return true;
}
- return false;
+ /*
+ * Another process may have created the directory since the check above. Accept
+ * it, with the permissions that process set: this call did not create it.
+ */
+ return is_dir( $target );
}
/**
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 9d53d07544..ae0d0ba943 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta3-65174';
+$wp_version = '7.2-beta3-65175';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.