From fc2c5fd21bfd4a08b63bbdc1ff8cdf78e713a172 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sun, 17 Jan 2010 02:57:59 +0000 Subject: [PATCH] Fix WP_Filesystem_Direct::mkdir() when running under safe_mode on certain versions of PHP. Props remi. Fixes #10497 git-svn-id: http://svn.automattic.com/wordpress/trunk@12741 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-filesystem-direct.php | 5 +++++ wp-includes/functions.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php index e18e257758..bdad6e609e 100644 --- a/wp-admin/includes/class-wp-filesystem-direct.php +++ b/wp-admin/includes/class-wp-filesystem-direct.php @@ -279,6 +279,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { } function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { + // safe mode fails with a trailing slash under certain PHP versions. + $path = untrailingslashit($path); + if ( empty($path) ) + $path = '/'; + if ( ! $chmod ) $chmod = FS_CHMOD_DIR; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 1afbaff1f6..9d5ff245ca 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1934,7 +1934,7 @@ 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. + // safe mode fails with a trailing slash under certain PHP versions. $target = untrailingslashit($target); if ( empty($target) ) $target = '/';