diff --git a/src/Symfony/Component/HttpClient/HttplugClient.php b/src/Symfony/Component/HttpClient/HttplugClient.php index b0a6d4a8cdf02..b01579d06f27a 100644 --- a/src/Symfony/Component/HttpClient/HttplugClient.php +++ b/src/Symfony/Component/HttpClient/HttplugClient.php @@ -202,7 +202,11 @@ public function createStream($content = ''): StreamInterface } if ($stream->isSeekable()) { - $stream->seek(0); + try { + $stream->seek(0); + } catch (\RuntimeException) { + // ignore + } } return $stream; @@ -274,7 +278,11 @@ private function sendPsr7Request(RequestInterface $request, ?bool $buffer = null $body = $request->getBody(); if ($body->isSeekable()) { - $body->seek(0); + try { + $body->seek(0); + } catch (\RuntimeException) { + // ignore + } } $options = [ diff --git a/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php b/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php index bebe135604a4e..1412fcf45466e 100644 --- a/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php +++ b/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php @@ -145,7 +145,11 @@ public static function createPsr7Response(ResponseFactoryInterface $responseFact } if ($body->isSeekable()) { - $body->seek(0); + try { + $body->seek(0); + } catch (\RuntimeException) { + // ignore + } } return $psrResponse->withBody($body); diff --git a/src/Symfony/Component/HttpClient/Psr18Client.php b/src/Symfony/Component/HttpClient/Psr18Client.php index d46a7b14d19a7..f138f55e81d92 100644 --- a/src/Symfony/Component/HttpClient/Psr18Client.php +++ b/src/Symfony/Component/HttpClient/Psr18Client.php @@ -90,7 +90,11 @@ public function sendRequest(RequestInterface $request): ResponseInterface $body = $request->getBody(); if ($body->isSeekable()) { - $body->seek(0); + try { + $body->seek(0); + } catch (\RuntimeException) { + // ignore + } } $options = [ @@ -136,7 +140,11 @@ public function createStream(string $content = ''): StreamInterface $stream = $this->streamFactory->createStream($content); if ($stream->isSeekable()) { - $stream->seek(0); + try { + $stream->seek(0); + } catch (\RuntimeException) { + // ignore + } } return $stream;