8000 merged branch webfactory/tolerant_esi_include (PR #2952) · mshtukin/symfony@228f3fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 228f3fc

Browse files
committed
merged branch webfactory/tolerant_esi_include (PR symfony#2952)
Commits ------- cae7db0 Be more tolerant and also accept <esi:include ...></esi:include>, also if it is not 100% standards compliant. Discussion ---------- Be more tolerant and also accept <esi:include ...></esi:include> I know this is not 100% standards compliant, but: We need to do some XHTML processing on the output using PHP's DOM extension and the underlying libxml2. libxml2 seems to be unable to keep the <esi:include /> tag as such and will expand it to ```<esi:include ...></esi:include>```. Note this has nothing to do with having LIBXML_NOEMPTYTAG set (http://php.net/manual/de/domdocument.savexml.php). Rather it seems to be a problem for libxml that it cannot recognize <esi:include> as an "EMPTY" tag (in the DTD sense) because it is not defined in a standard xhtml1-strict DTD.
2 parents 8282cd9 + cae7db0 commit 228f3fc

File tree

1 file changed

+2
-2
lines changed
  • src/Symfony/Component/HttpKernel/HttpCache

1 file changed

+2
-2
lines changed

src/Symfony/Component/HttpKernel/HttpCache/Esi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ public function process(Request $request, Response $response)
154154

155155
// we don't use a proper XML parser here as we can have ESI tags in a plain text response
156156
$content = $response->getContent();
157-
$content = preg_replace_callback('#<esi\:include\s+(.*?)\s*/>#', array($this, 'handleEsiIncludeTag'), $content);
158-
$content = preg_replace('#<esi\:comment[^>]*/>#', '', $content);
157+
$content = preg_replace_callback('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', array($this, 'handleEsiIncludeTag'), $content);
158+
$content = preg_replace('#<esi\:comment[^>]*(?:/|</esi\:comment)>#', '', $content);
159159
$content = preg_replace('#<esi\:remove>.*?</esi\:remove>#', '', $content);
160160

161161
$response->setContent($content);

0 commit comments

Comments
 (0)
0