BUG 7362 dont include trailing space in bare string

This commit is contained in:
Hamish Friedlander 2012-07-23 11:56:44 +12:00
parent 2664cb2d67
commit e160b76df5
3 changed files with 7 additions and 3 deletions

View File

@ -392,6 +392,10 @@ after')
$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 @@ after')
$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 File

@ -1146,7 +1146,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'])) . "'";
}
/* ComparisonOperator: "==" | "!=" | "=" */

View File

@ -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'])) . "'";
}
/*!*