浏览代码

Fixed issue in the computation of the application absolute path (Windows)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1291 a333f486-631f-4898-b8df-5754b55c2be0
romainq 14 年之前
父节点
当前提交
e6034cb278
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      application/utils.inc.php

+ 4 - 2
application/utils.inc.php

@@ -398,7 +398,9 @@ class utils
 	{
 		$sAbsoluteUrl = self::GetAbsoluteUrl(false, $bForceHTTPS); // False => Don't get the query string
 		$sCurrentScript = realpath($_SERVER['SCRIPT_FILENAME']);
-		$sCurrentRelativePath = str_replace(APPROOT, '', $sCurrentScript);
+		$sCurrentScript = str_replace('\\', '/', $sCurrentScript); // canonical path
+		$sAppRoot = str_replace('\\', '/', APPROOT); // canonical path
+		$sCurrentRelativePath = str_replace($sAppRoot, '', $sCurrentScript);
 	
 		$sAppRootPos = strpos($sAbsoluteUrl, $sCurrentRelativePath);
 		if ($sAppRootPos !== false)
@@ -407,7 +409,7 @@ class utils
 		}
 		else
 		{
-			throw new Exception("Failed to determine application root path $sAbsoluteUrl ($sCurrentRelativePath)");
+			throw new Exception("Failed to determine application root path $sAbsoluteUrl ($sCurrentRelativePath) APPROOT:'$sAppRoot'");
 		}
 		return $sAbsoluteUrl;
 	}