updated-packages
This commit is contained in:
12
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
12
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
@@ -37,7 +37,7 @@ class Esi extends AbstractSurrogate
|
||||
*/
|
||||
public function addSurrogateControl(Response $response)
|
||||
{
|
||||
if (false !== strpos($response->getContent(), '<esi:include')) {
|
||||
if (str_contains($response->getContent(), '<esi:include')) {
|
||||
$response->headers->set('Surrogate-Control', 'content="ESI/1.0"');
|
||||
}
|
||||
}
|
||||
@@ -80,13 +80,13 @@ class Esi extends AbstractSurrogate
|
||||
$content = preg_replace('#<esi\:remove>.*?</esi\:remove>#s', '', $content);
|
||||
$content = preg_replace('#<esi\:comment[^>]+>#s', '', $content);
|
||||
|
||||
$chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
|
||||
$chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
|
||||
|
||||
$i = 1;
|
||||
while (isset($chunks[$i])) {
|
||||
$options = array();
|
||||
preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER);
|
||||
$options = [];
|
||||
preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, \PREG_SET_ORDER);
|
||||
foreach ($matches as $set) {
|
||||
$options[$set[1]] = $set[2];
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class Esi extends AbstractSurrogate
|
||||
|
||||
$chunks[$i] = sprintf('<?php echo $this->surrogate->handle($this, %s, %s, %s) ?>'."\n",
|
||||
var_export($options['src'], true),
|
||||
var_export(isset($options['alt']) ? $options['alt'] : '', true),
|
||||
var_export($options['alt'] ?? '', true),
|
||||
isset($options['onerror']) && 'continue' === $options['onerror'] ? 'true' : 'false'
|
||||
);
|
||||
++$i;
|
||||
@@ -111,5 +111,7 @@ class Esi extends AbstractSurrogate
|
||||
|
||||
// remove ESI/1.0 from the Surrogate-Control header
|
||||
$this->removeFromControl($response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user