From 257d1571378911d6bdc8178f7f90be889396e610 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 28 Feb 2012 03:50:32 +0100 Subject: [PATCH] Fixes wrong anchor if php and path omitted Fixes #458 --- wcfsetup/install/files/lib/system/WCF.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index ac8d36d9a2..bd99513636 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -631,7 +631,13 @@ class WCF { */ public function getAnchor($fragment) { // resolve path and query components - $path = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['REQUEST_URI']); + $scriptName = $_SERVER['SCRIPT_NAME']; + if (empty($_SERVER['PATH_INFO'])) { + // bug fix if URL omits script name and path + $scriptName = substr($scriptName, 0, strrpos($scriptName, '/')); + } + + $path = str_replace($scriptName, '', $_SERVER['REQUEST_URI']); $baseHref = self::getTPL()->get('baseHref'); return $baseHref . 'index.php' . $path . '#' . $fragment; -- 2.20.1