From 95166aa0cfacc3925971d5b97c6025ecfa20bd3d Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 17 Jan 2010 02:44:47 +0000 Subject: [PATCH] Fix wp_mkdir_p() when running under safe_mode on certain PHP versions. Props Denis-de-Bernardy. Fixes #8830 git-svn-id: https://develop.svn.wordpress.org/trunk@12740 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ad1e7a7ca0..1afbaff1f6 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1933,6 +1933,12 @@ function wp_get_original_referer() { function wp_mkdir_p( $target ) { // from php.net/mkdir user contributed notes $target = str_replace( '//', '/', $target ); + + // safe mode fails with trailing slash under certain PHP versions. + $target = untrailingslashit($target); + if ( empty($target) ) + $target = '/'; + if ( file_exists( $target ) ) return @is_dir( $target );