From f1bc3dde7b2e24796dfce7719e6bfd00d63ce082 Mon Sep 17 00:00:00 2001 From: dd32 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: http://svn.automattic.com/wordpress/trunk@12740 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ad1e7a7ca..1afbaff1f 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 );