From: Jan Schneider Date: Tue, 21 Dec 2010 19:13:48 +0000 (+0100) Subject: Fix selfUrl() result when using URL rewriting. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f765cfb84ee066ab383d057fffdd16dfc51a1c73;p=horde.git Fix selfUrl() result when using URL rewriting. --- diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 19cb34335..84a8634d2 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -1228,6 +1228,9 @@ HTML; $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']; } + if (isset($_SERVER['REQUEST_URI'])) { + $url = Horde_String::common($_SERVER['REQUEST_URI'], $url); + } if (substr($url, -9) == 'index.php') { $url = substr($url, 0, -9); } diff --git a/framework/Core/test/Horde/Core/UrlTest.php b/framework/Core/test/Horde/Core/UrlTest.php index 148b9a13d..543d1c9b6 100644 --- a/framework/Core/test/Horde/Core/UrlTest.php +++ b/framework/Core/test/Horde/Core/UrlTest.php @@ -352,7 +352,7 @@ class Horde_Core_UrlTest extends PHPUnit_Framework_TestCase $this->assertEquals('http://example.com/hordeurl/test/foo/bar?foo=bar&x=y', (string)Horde::selfUrl(true, false, true)); $_SERVER['REQUEST_URI'] = '/hordeurl/foo/bar?foo=bar&x=y'; $_SERVER['SCRIPT_NAME'] = '/hordeurl/test.php'; - $this->assertEquals('/hordeurl/test.php', (string)Horde::selfUrl()); + $this->assertEquals('/hordeurl/', (string)Horde::selfUrl()); $this->assertEquals('/hordeurl/foo/bar?foo=bar&x=y', (string)Horde::selfUrl(true)); } }