diff --git a/core/SSViewer.php b/core/SSViewer.php
index 80cf1e430..c060d638b 100755
--- a/core/SSViewer.php
+++ b/core/SSViewer.php
@@ -439,10 +439,9 @@ class SSViewer {
if($this->rewriteHashlinks && self::$options['rewriteHashlinks']) {
if(strpos($output, ''), array('&','"',''','<','>'), \$_SERVER['REQUEST_URI']); ?>";
+ $thisURLRelativeToBase = "";
} else {
- $thisURLRelativeToBase = Convert::raw2att($_SERVER['REQUEST_URI']);
+ $thisURLRelativeToBase = strip_tags($_SERVER['REQUEST_URI']);
}
$output = preg_replace('/(]+href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output);
}
@@ -607,7 +606,7 @@ class SSViewer {
$content = ereg_replace('', ' } ?>', $content);
// Fix link stuff
- $content = ereg_replace('href *= *"#', 'href="= SSViewer::$options[\'rewriteHashlinks\'] ? Convert::raw2att( $_SERVER[\'REQUEST_URI\'] ) : "" ?>#', $content);
+ $content = ereg_replace('href *= *"#', 'href="= SSViewer::$options[\'rewriteHashlinks\'] ? strip_tags( $_SERVER[\'REQUEST_URI\'] ) : "" ?>#', $content);
// Protect xml header
$content = ereg_replace('<\?xml([^>]+)\?' . '>', '<##xml\\1##>', $content);
diff --git a/tests/SSViewerTest.php b/tests/SSViewerTest.php
index ab3120363..4c59fe650 100644
--- a/tests/SSViewerTest.php
+++ b/tests/SSViewerTest.php
@@ -193,7 +193,7 @@ SS
$obj->InsertedLink = 'InsertedLink';
$result = $tmpl->process($obj);
$this->assertContains(
- '