From 7aa8054979b240f24fe2dd05001618957bdda6b8 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 19 Jan 2007 10:40:57 +0000 Subject: [PATCH] Normalize / to DIRECTORY_SEPARATOR in wfRelativePath() input, plays nicer on Windows --- includes/GlobalFunctions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 49760553c3..950d029520 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1857,6 +1857,10 @@ function wfBaseName( $path ) { * @return string */ function wfRelativePath( $path, $from ) { + // Normalize mixed input on Windows... + $path = str_replace( '/', DIRECTORY_SEPARATOR, $path ); + $from = str_replace( '/', DIRECTORY_SEPARATOR, $from ); + $pieces = explode( DIRECTORY_SEPARATOR, dirname( $path ) ); $against = explode( DIRECTORY_SEPARATOR, $from ); -- 2.20.1