diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 23e04cf504..9b5f292eec 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1764,17 +1764,30 @@ function path_join( $base, $path ) { * @since 3.9.0 * @since 4.4.0 Ensures upper-case drive letters on Windows systems. * @since 4.5.0 Allows for Windows network shares. + * @since 5.0.0 Allows for PHP file wrappers. * * @param string $path Path to normalize. * @return string Normalized path. */ function wp_normalize_path( $path ) { + $wrapper = ''; + if ( wp_is_stream( $path ) ) { + list( $wrapper, $path ) = explode( '://', $path, 2 ); + $wrapper .= '://'; + } + + // Standardise all paths to use / $path = str_replace( '\\', '/', $path ); + + // Replace multiple slashes down to a singular, allowing for network shares having two slashes. $path = preg_replace( '|(?<=.)/+|', '/', $path ); + + // Windows paths should uppercase the drive letter if ( ':' === substr( $path, 1, 1 ) ) { $path = ucfirst( $path ); } - return $path; + + return $wrapper . $path; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index c25676b90f..53339ebd8f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42386'; +$wp_version = '5.0-alpha-42387'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.