Skip to content

Commit 02b70e9

Browse files
committed
improve StreamTrait workaround
1 parent d52d75e commit 02b70e9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

api.include.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ public function withoutAttribute($attribute): ServerRequestInterface
22682268
*/
22692269
class Stream implements StreamInterface
22702270
{
2271-
function __toString():string { return ""; }
2271+
function __toString():string { if ($this->isSeekable()) { $this->seek(0); } return $this->getContents(); }
22722272

22732273
/** @var resource|null A resource reference */
22742274
private $stream;

api.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ public function withoutAttribute($attribute): ServerRequestInterface
22682268
*/
22692269
class Stream implements StreamInterface
22702270
{
2271-
function __toString():string { return ""; }
2271+
function __toString():string { if ($this->isSeekable()) { $this->seek(0); } return $this->getContents(); }
22722272

22732273
/** @var resource|null A resource reference */
22742274
private $stream;

build.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function run(string $base, array $dirs, string $filename, array $ignore, array $
109109
];
110110

111111
$replaces = [
112-
'use StreamTrait;' => 'function __toString():string { return ""; }'
112+
'use StreamTrait;' => 'function __toString():string { if ($this->isSeekable()) { $this->seek(0); } return $this->getContents(); }'
113113
];
114114

115115
$directories = ['vendor/nyholm', 'src'];

0 commit comments

Comments
 (0)