File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/Symfony/Component/HttpClient 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
281
281
'uid ' => 0 ,
282
282
'gid ' => 0 ,
283
283
'rdev ' => 0 ,
284
- 'size ' => (int ) ($ headers ['content-length ' ][0 ] ?? 0 ),
284
+ 'size ' => (int ) ($ headers ['content-length ' ][0 ] ?? - 1 ),
285
285
'atime ' => 0 ,
286
286
'mtime ' => strtotime ($ headers ['last-modified ' ][0 ] ?? '' ) ?: 0 ,
287
287
'ctime ' => 0 ,
Original file line number Diff line number Diff line change @@ -63,6 +63,19 @@ public function testToStream()
63
63
$ this ->assertTrue (feof ($ stream ));
64
64
}
65
65
66
+ public function testStreamCopyToStream ()
<
9010
td data-grid-cell-id="diff-9376e4179e2a1c5e0eeaa3cf6226f0e5509ff79a5c8499825586eb7d61d5d3c4-65-67-0" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionNum-bgColor, var(--diffBlob-addition-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">
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
+
66
79
public function testToStream404 ()
67
80
{
68
81
$ client = $ this ->getHttpClient (__FUNCTION__ );
You can’t perform that action at this time.
0 commit comments