Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUG 7362 dont include trailing space in bare string

  • Loading branch information...
commit e160b76df5a0fee256e30c5de17a7cf28b8bd889 1 parent 2664cb2
@hafriedlander hafriedlander authored
View
6 tests/view/SSViewerTest.php
@@ -392,6 +392,10 @@ function testIfBlocks() {
$this->assertEquals('AD',
$this->render('A<% if Right == Wrong %>B<% else_if RawVal != RawVal %>C<% end_if %>D'));
+ // Bare words with ending space
+ $this->assertEquals('ABC',
+ $this->render('A<% if "RawVal" == RawVal %>B<% end_if %>C'));
+
// Else
$this->assertEquals('ADE',
$this->render('A<% if Right == Wrong %>B<% else_if RawVal != RawVal %>C<% else %>D<% end_if %>E'));
@@ -457,7 +461,7 @@ function testIncludeWithArguments() {
$this->assertEquals(
$this->render('<% include SSViewerTestIncludeWithArguments Arg1=A Bare String, Arg2=B Bare String %>'),
- '<p>A Bare String</p><p>B Bare String </p>'
+ '<p>A Bare String</p><p>B Bare String</p>'
);
$this->assertEquals(
View
2  view/SSTemplateParser.php
@@ -1146,7 +1146,7 @@ function Argument_Lookup(&$res, $sub) {
function Argument_FreeString(&$res, $sub) {
$res['ArgumentMode'] = 'string';
- $res['php'] = "'" . str_replace("'", "\\'", $sub['text']) . "'";
+ $res['php'] = "'" . str_replace("'", "\\'", trim($sub['text'])) . "'";
}
/* ComparisonOperator: "==" | "!=" | "=" */
View
2  view/SSTemplateParser.php.inc
@@ -322,7 +322,7 @@ class SSTemplateParser extends Parser {
function Argument_FreeString(&$res, $sub) {
$res['ArgumentMode'] = 'string';
- $res['php'] = "'" . str_replace("'", "\\'", $sub['text']) . "'";
+ $res['php'] = "'" . str_replace("'", "\\'", trim($sub['text'])) . "'";
}
/*!*
Please sign in to comment.
Something went wrong with that request. Please try again.