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 33
44## Unreleased
55
6+ ## Added
7+
8+ - Check for empty string in Stream factories
9+
610## Fixed
711
812 - 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)
2424 } else {
2525 $ stream = new Stream ('php://memory ' , 'rw ' );
2626
27- if (null ! == $ body ) {
28- $ stream -> write (( string ) $ body ) ;
27+ if (null === $ body || '' = == $ body ) {
28+ return $ stream ;
2929 }
3030
31+ $ stream ->write ((string ) $ body );
32+
3133 $ body = $ stream ;
3234 }
3335 }
Original file line number Diff line number Diff line change @@ -28,9 +28,11 @@ public function createStream($body = null)
2828 $ resource = fopen ('php://memory ' , 'r+ ' );
2929 $ stream = new Stream ($ resource );
3030
31- if (null ! == $ body ) {
32- $ stream -> write (( string ) $ body ) ;
31+ if (null === $ body || '' = == $ body ) {
32+ return $ stream ;
3333 }
34+
35+ $ stream ->write ((string ) $ body );
3436 }
3537
3638 $ stream ->rewind ();
You can’t perform that action at this time.
0 commit comments