From f765cfb84ee066ab383d057fffdd16dfc51a1c73 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 21 Dec 2010 20:13:48 +0100 Subject: [PATCH] Fix selfUrl() result when using URL rewriting. --- framework/Core/lib/Horde.php | 3 +++ framework/Core/test/Horde/Core/UrlTest.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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)); } } -- 2.11.0