Skip to content

Commit

Permalink
[BUGFIX] Always send strings to the method createStream
Browse files Browse the repository at this point in the history
PHP8.1 throws an TypeError if we sending null to createStream

Resolves: #98417
Releases: main, 11.5
Change-Id: I327751c2cb13991122c84f4333a4976b9d0a0dae
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75878
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
  • Loading branch information
mvoehringer authored and maddy2101 committed Oct 21, 2022
1 parent da2fb6d commit 46a24a0
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -1089,7 +1089,7 @@ protected function htmlResponse(string $html = null): ResponseInterface
{
return $this->responseFactory->createResponse()
->withHeader('Content-Type', 'text/html; charset=utf-8')
->withBody($this->streamFactory->createStream($html ?? $this->view->render()));
->withBody($this->streamFactory->createStream((string)($html ?? $this->view->render())));
}

/**
Expand All @@ -1103,6 +1103,6 @@ protected function jsonResponse(string $json = null): ResponseInterface
{
return $this->responseFactory->createResponse()
->withHeader('Content-Type', 'application/json; charset=utf-8')
->withBody($this->streamFactory->createStream($json ?? $this->view->render()));
->withBody($this->streamFactory->createStream((string)($json ?? $this->view->render())));
}
}

0 comments on commit 46a24a0

Please sign in to comment.