File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 3
3
4
4
## Unreleased
5
5
6
+ ## Added
7
+
8
+ - Check for empty string in Stream factories
9
+
6
10
## Fixed
7
11
8
12
- FilteredStream::getSize returns null because the contents size is unknown.
Original file line number Diff line number Diff line change @@ -24,10 +24,12 @@ public function createStream($body = null)
24
24
} else {
25
25
$ stream = new Stream ('php://memory ' , 'rw ' );
26
26
27
- if (null ! == $ body ) {
28
- $ stream -> write (( string ) $ body ) ;
27
+ if (null === $ body || '' = == $ body ) {
28
+ return $ stream ;
29
29
}
30
30
31
+ $ stream ->write ((string ) $ body );
32
+
31
33
$ body = $ stream ;
32
34
}
33
35
}
Original file line number Diff line number Diff line change @@ -28,9 +28,11 @@ public function createStream($body = null)
28
28
$ resource = fopen ('php://memory ' , 'r+ ' );
29
29
$ stream = new Stream ($ resource );
30
30
31
- if (null ! == $ body ) {
32
- $ stream -> write (( string ) $ body ) ;
31
+ if (null === $ body || '' = == $ body ) {
32
+ return $ stream ;
33
33
}
34
+
35
+ $ stream ->write ((string ) $ body );
34
36
}
35
37
36
38
$ stream ->rewind ();
You can’t perform that action at this time.
0 commit comments