Skip to content

Commit

Permalink
Escape SSI virtual in generated response
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérémy Derussé committed Sep 4, 2014
1 parent f940d92 commit 1862427
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Symfony/Component/HttpKernel/HttpCache/Ssi.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,8 @@ private function handleIncludeTag($attributes)
throw new \RuntimeException('Unable to process an SSI tag without a "virtual" attribute.');
}

return sprintf('<?php echo $this->surrogate->handle($this, \'%s\', \'%s\', %s) ?>' . "\n",
$options['virtual'],
'',
'false'
return sprintf('<?php echo $this->surrogate->handle($this, %s, \'\', false) ?>' . "\n",
var_export($options['virtual'], true)
);
}
}
5 changes: 5 additions & 0 deletions src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public function testProcess()

$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
$this->assertEquals('SSI', $response->headers->get('x-body-eval'));

$response = new Response('foo <!--#include virtual="foo\'" -->');
$ssi->process($request, $response);

$this->assertEquals("foo <?php echo \$this->surrogate->handle(\$this, 'foo\\'', '', false) ?>"."\n", $response->getContent());
}

public function testProcessEscapesPhpTags()
Expand Down

0 comments on commit 1862427

Please sign in to comment.