We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1ec69e commit 63b68caCopy full SHA for 63b68ca
src/Stream.php
@@ -52,10 +52,12 @@ class Stream implements StreamInterface
52
public function __construct($stream = 'php://temp', string $mode = 'wb+')
53
{
54
if (\is_string($stream)) {
55
- $stream = '' === $stream ? false : @\fopen($stream, $mode);
56
-
57
- if (false === $stream) {
58
- throw new \RuntimeException('The stream or file cannot be opened.');
+ if (\file_exists($stream)) {
+ $stream = @\fopen($stream, $mode);
+ } else {
+ $resource = \fopen('php://temp', 'rw+');
59
+ \fwrite($resource, $stream);
60
+ $stream = $resource;
61
}
62
63
0 commit comments