Skip to content

Commit

Permalink
Update AbstractRequestFormatter.php PHPCS fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ssi-anik authored Aug 28, 2024
1 parent 1297208 commit 3308c9f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Formatter/AbstractRequestFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ final protected function getRequestBody(RequestInterface $request): string
if ($body->getSize() > 8192) {
return '[too long stream omitted]';
}

if ($body->isSeekable()) {
$previousPosition = $body->tell();
$body->rewind();
$contents = $body->getContents();
$body->seek($previousPosition);

if (preg_match('/[\x00-\x1F\x7F]/', $contents)) {
return '[binary stream omitted]';
}

// clean input of null bytes
return str_replace(chr(0), '', $contents);
return str_replace(chr(0), '', $contents ?: '');
}

return '[non-seekable stream omitted]';
Expand Down

0 comments on commit 3308c9f

Please sign in to comment.