From: Alexander Ebert Date: Wed, 11 Mar 2015 17:05:28 +0000 (+0100) Subject: Work-around for IIS URL-Rewrite-Module messing up the encoding X-Git-Tag: 2.1.2~53^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4e2bca91946ee240ecbb8e2963b9ad4dd682c761;p=GitHub%2FWoltLab%2FWCF.git Work-around for IIS URL-Rewrite-Module messing up the encoding There is a known bug which causes REQUEST_URI to be ISO-encoded, even though there is a hotfix enabled, certain Plesk versions do not ship that fix. Since it is safe to rely on UNENCODED_URL, we'll fall back to this one. --- diff --git a/wcfsetup/install/files/lib/page/AbstractPage.class.php b/wcfsetup/install/files/lib/page/AbstractPage.class.php index a729fed915..2e66ce275f 100644 --- a/wcfsetup/install/files/lib/page/AbstractPage.class.php +++ b/wcfsetup/install/files/lib/page/AbstractPage.class.php @@ -185,7 +185,10 @@ abstract class AbstractPage implements IPage, ITrackablePage { $canoncialURL = parse_url(preg_replace('~[?&]s=[a-f0-9]{40}~', '', $this->canonicalURL)); // use $_SERVER['REQUEST_URI'] because it represents the URL used to access the site and not the internally rewritten one - $requestURI = preg_replace('~[?&]s=[a-f0-9]{40}~', '', $_SERVER['REQUEST_URI']); + // IIS Rewrite-Module has a bug causing the REQUEST_URI to be ISO-encoded + $requestURI = (!empty($_SERVER['UNENCODED_URL'])) ? $_SERVER['UNENCODED_URL'] : $_SERVER['REQUEST_URI']; + $requestURI = preg_replace('~[?&]s=[a-f0-9]{40}~', '', $requestURI); + if (!StringUtil::isUTF8($requestURI)) { $requestURI = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $requestURI); }