diff --git a/core/SSViewer.php b/core/SSViewer.php index 5ef04e51d..00153dd28 100644 --- a/core/SSViewer.php +++ b/core/SSViewer.php @@ -355,6 +355,7 @@ class SSViewer extends Object { // $val, $val.property, $val(param), etc. $replacements = array( + '/<%--.*--%>/U' => '', '/\$Iteration/' => '', '/{\\$([A-Za-z_][A-Za-z0-9_]*)\\(([^),]+), *([^),]+)\\)\\.([A-Za-z0-9_]+)\\.([A-Za-z0-9_]+)}/' => 'obj("\\1",array("\\2","\\3"),true)->obj("\\4",null,true)->XML_val("\\5",null,true) ?>', '/{\\$([A-Za-z_][A-Za-z0-9_]*)\\(([^),]+), *([^),]+)\\)\\.([A-Za-z0-9_]+)}/' => 'obj("\\1",array("\\2","\\3"),true)->XML_val("\\4",null,true) ?>', diff --git a/tests/SSViewerTest.php b/tests/SSViewerTest.php index e2a7e1f42..352e57a6b 100644 --- a/tests/SSViewerTest.php +++ b/tests/SSViewerTest.php @@ -33,4 +33,14 @@ SS $template = $viewer->process($data); $this->assertFalse((bool)trim($template), "Should be no content in this return."); } + + function testComments() { + $viewer = SSViewer::fromString(<<This is some content<%-- this is another comment --%>This is the final content +SS +); + $output = $viewer->process(new ArrayData(array())); + + $this->assertEquals("This is my templateThis is some contentThis is the final content", $output); + } } \ No newline at end of file