Skip to content

Commit 464ea3a

Browse files
author
Jérémy Derussé
committed
Escape SSI virtual in generated response
1 parent 3ee13b9 commit 464ea3a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

HttpCache/Ssi.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,8 @@ private function handleIncludeTag($attributes)
188188
throw new \RuntimeException('Unable to process an SSI tag without a "virtual" attribute.');
189189
}
190190

191-
return sprintf('<?php echo $this->surrogate->handle($this, \'%s\', \'%s\', %s) ?>' . "\n",
192-
$options['virtual'],
193-
'',
194-
'false'
191+
return sprintf('<?php echo $this->surrogate->handle($this, %s, \'\', false) ?>' . "\n",
192+
var_export($options['virtual'], true)
195193
);
196194
}
197195
}

Tests/HttpCache/SsiTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ public function testProcess()
101101

102102
$this->assertEquals('foo <?php echo $this->surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
103103
$this->assertEquals('SSI', $response->headers->get('x-body-eval'));
104+
105+
$response = new Response('foo <!--#include virtual="foo\'" -->');
106+
$ssi->process($request, $response);
107+
108+
$this->assertEquals("foo <?php echo \$this->surrogate->handle(\$this, 'foo\\'', '', false) ?>"."\n", $response->getContent());
104109
}
105110

106111
public function testProcessEscapesPhpTags()

0 commit comments

Comments
 (0)