Normalize / to DIRECTORY_SEPARATOR in wfRelativePath() input, plays nicer on Windows
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 19 Jan 2007 10:40:57 +0000 (10:40 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 19 Jan 2007 10:40:57 +0000 (10:40 +0000)
includes/GlobalFunctions.php

index 4976055..950d029 100644 (file)
@@ -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 );