Update dependencies

This commit is contained in:
Chris Hunt
2024-02-16 21:36:54 +00:00
parent 22d7a59e59
commit d52ae0d3c3
9569 changed files with 460443 additions and 282416 deletions

View File

@@ -21,16 +21,13 @@ use Symfony\Component\HttpFoundation\Response;
*/
class Ssi extends AbstractSurrogate
{
/**
* {@inheritdoc}
*/
public function getName()
public function getName(): string
{
return 'ssi';
}
/**
* {@inheritdoc}
* @return void
*/
public function addSurrogateControl(Response $response)
{
@@ -39,18 +36,12 @@ class Ssi extends AbstractSurrogate
}
}
/**
* {@inheritdoc}
*/
public function renderIncludeTag(string $uri, string $alt = null, bool $ignoreErrors = true, string $comment = '')
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
{
return sprintf('<!--#include virtual="%s" -->', $uri);
}
/**
* {@inheritdoc}
*/
public function process(Request $request, Response $response)
public function process(Request $request, Response $response): Response
{
$type = $response->headers->get('Content-Type');
if (empty($type)) {
@@ -64,9 +55,8 @@ class Ssi extends AbstractSurrogate
// we don't use a proper XML parser here as we can have SSI tags in a plain text response
$content = $response->getContent();
$boundary = self::generateBodyEvalBoundary();
$chunks = preg_split('#<!--\#include\s+(.*?)\s*-->#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
$chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
$i = 1;
while (isset($chunks[$i])) {
@@ -80,14 +70,10 @@ class Ssi extends AbstractSurrogate
throw new \RuntimeException('Unable to process an SSI tag without a "virtual" attribute.');
}
$chunks[$i] = sprintf('<?php echo $this->surrogate->handle($this, %s, \'\', false) ?>'."\n",
var_export($options['virtual'], true)
);
++$i;
$chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]);
++$i;
$chunks[$i] = $boundary.$options['virtual']."\n\n\n";
$i += 2;
}
$content = implode('', $chunks);
$content = $boundary.implode('', $chunks).$boundary;
$response->setContent($content);
$response->headers->set('X-Body-Eval', 'SSI');