From: Brion Vibber Date: Fri, 19 Jan 2007 10:40:57 +0000 (+0000) Subject: Normalize / to DIRECTORY_SEPARATOR in wfRelativePath() input, plays nicer on Windows X-Git-Tag: 1.31.0-rc.0~54301 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=7aa8054979b240f24fe2dd05001618957bdda6b8;p=lhc%2Fweb%2Fwiklou.git Normalize / to DIRECTORY_SEPARATOR in wfRelativePath() input, plays nicer on Windows --- 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 );