[HttpKernel] hinclude fragment renderer must escape URIs properly to return valid html
This commit is contained in:
parent
83fc5ed98f
commit
54d7d258c1
@ -64,6 +64,9 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
|||||||
$uri = $this->signer->sign($this->generateFragmentUri($uri, $request));
|
$uri = $this->signer->sign($this->generateFragmentUri($uri, $request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content.
|
||||||
|
$uri = str_replace('&', '&', $uri);
|
||||||
|
|
||||||
$template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
|
$template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
|
||||||
if (null !== $this->templating && $template && $this->templateExists($template)) {
|
if (null !== $this->templating && $template && $this->templateExists($template)) {
|
||||||
$content = $this->templating->render($template);
|
$content = $this->templating->render($template);
|
||||||
|
@ -38,7 +38,7 @@ class HIncludeFragmentRendererTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo'));
|
$strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo'));
|
||||||
|
|
||||||
$this->assertEquals('<hx:include src="http://localhost/_fragment?_path=_format%3Dhtml%26_controller%3Dmain_controller&_hash=VI25qJj8J0qveB3bGKPhsJtexKg%3D"></hx:include>', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent());
|
$this->assertEquals('<hx:include src="http://localhost/_fragment?_path=_format%3Dhtml%26_controller%3Dmain_controller&_hash=VI25qJj8J0qveB3bGKPhsJtexKg%3D"></hx:include>', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRenderWithUri()
|
public function testRenderWithUri()
|
||||||
|
Reference in New Issue
Block a user