Skip to content

BUGFIX: Respect psr buffer streams and use them for string streams #3333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: 9.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Neos.Flow/Classes/Mvc/ActionResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ public function getHttpHeader(string $headerName)
public function getContent(): string
{
$content = $this->content->getContents();
$this->content->rewind();
if ($this->content->isSeekable()) {
$this->content->rewind();
}
return $content;
}

Expand Down
10 changes: 4 additions & 6 deletions Neos.Http.Factories/Classes/StreamFactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

namespace Neos\Http\Factories;

use GuzzleHttp\Psr7\BufferStream;
use GuzzleHttp\Psr7\Stream;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\StreamInterface;

/**
Expand All @@ -17,11 +17,9 @@ trait StreamFactoryTrait
*/
public function createStream(string $content = ''): StreamInterface
{
$fileHandle = fopen('php://temp', 'r+');
fwrite($fileHandle, $content);
rewind($fileHandle);

return $this->createStreamFromResource($fileHandle);
$stream = new BufferStream();
$stream->write($content);
return $stream;
}

/**
Expand Down
Loading