Skip to content

Commit 8d2ca1d

Browse files
committed
only cast on Stream
1 parent a3dc55f commit 8d2ca1d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Handler/Logging.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use ErrorHeroModule\Handler\Formatter\Json;
99
use ErrorHeroModule\Handler\Writer\Mail;
1010
use ErrorHeroModule\HeroConstant;
11+
use Laminas\Diactoros\Stream;
1112
use Laminas\Http\Header\Cookie;
1213
use Laminas\Http\PhpEnvironment\RemoteAddress;
1314
use Laminas\Http\PhpEnvironment\Request as HttpRequest;
@@ -91,10 +92,16 @@ private function getRequestData(?RequestInterface $request): array
9192
/** @var ParametersInterface $files*/
9293
$files = $request->getFiles();
9394

95+
$content = $request->getContent();
96+
97+
if ($content instanceof Stream) {
98+
$content = (string) $content;
99+
}
100+
94101
$queryData = $query->toArray();
95102
$requestMethod = $request->getMethod();
96103
$bodyData = $post->toArray();
97-
$rawData = str_replace(PHP_EOL, '', $request->getContent());
104+
$rawData = str_replace(PHP_EOL, '', $content);
98105
$filesData = $this->includeFilesToAttachments
99106
? $files->toArray()
100107
: [];

0 commit comments

Comments
 (0)