File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ public function stream_stat(): array
281281 'uid ' => 0 ,
282282 'gid ' => 0 ,
283283 'rdev ' => 0 ,
284- 'size ' => (int ) ($ headers ['content-length ' ][0 ] ?? 0 ),
284+ 'size ' => (int ) ($ headers ['content-length ' ][0 ] ?? - 1 ),
285285 'atime ' => 0 ,
286286 'mtime ' => strtotime ($ headers ['last-modified ' ][0 ] ?? '' ) ?: 0 ,
287287 'ctime ' => 0 ,
Original file line number Diff line number Diff line change @@ -63,6 +63,19 @@ public function testToStream()
6363 $ this ->assertTrue (feof ($ stream ));
6464 }
6565
66+ public function testStreamCopyToStream ()
67+ {
68+ $ client = $ this ->getHttpClient (__FUNCTION__ );
69+ $ response = $ client ->request ('GET ' , 'http://localhost:8057 ' );
70+ $ h = fopen ('php://temp ' , 'w+ ' );
71+ stream_copy_to_stream ($ response ->toStream (), $ h );
72+
73+ $ this ->assertTrue (rewind ($ h ));
74+ $ this ->assertSame ("{ \n \"SER " , fread ($ h , 10 ));
75+ $ this ->assertSame ('VER_PROTOCOL ' , fread ($ h , 12 ));
76+ $ this ->assertFalse (feof ($ h ));
77+ }
78+
6679 public function testToStream404 ()
6780 {
6881 $ client = $ this ->getHttpClient (__FUNCTION__ );
You can’t perform that action at this time.
0 commit comments