Escape SSI virtual in generated response

This commit is contained in:
Jérémy Derussé 2014-09-04 20:59:01 +02:00
parent f940d92a32
commit 18624270bb
2 changed files with 7 additions and 4 deletions

View File

@ -188,10 +188,8 @@ class Ssi implements SurrogateInterface
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)
);
}
}

View File

@ -101,6 +101,11 @@ class SsiTest extends \PHPUnit_Framework_TestCase
$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()