Skip to content

Commit

Permalink
Merge branch '4.4' into 5.2
Browse files Browse the repository at this point in the history
* 4.4:
  skip intl dependent tests if the extension is missing
  make DateCaster tests timezone-agnostic
  error if the input string couldn't be parsed as a date
  IntegerType: Always use en for IntegerToLocalizedStringTransformer Fixes #40456
  Uses the correct assignment action for console options depending if they are short or long
  [HttpKernel] ConfigDataCollector to return known data without the need of a Kernel
  [HttpClient] fix using stream_copy_to_stream() with responses cast to php streams
  FIx Trying to clone an uncloneable object of class
  • Loading branch information
xabbuh committed Mar 28, 2021
2 parents 2b9f0d4 + 911177e commit 3c30754
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Response/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function stream_stat(): array
'uid' => 0,
'gid' => 0,
'rdev' => 0,
'size' => (int) ($headers['content-length'][0] ?? 0),
'size' => (int) ($headers['content-length'][0] ?? -1),
'atime' => 0,
'mtime' => strtotime($headers['last-modified'][0] ?? '') ?: 0,
'ctime' => 0,
Expand Down
13 changes: 13 additions & 0 deletions Tests/HttpClientTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ public function testToStream()
$this->assertTrue(feof($stream));
}

public function testStreamCopyToStream()
{
$client = $this->getHttpClient(__FUNCTION__);
$response = $client->request('GET', 'http://localhost:8057');
$h = fopen('php://temp', 'w+');
stream_copy_to_stream($response->toStream(), $h);

$this->assertTrue(rewind($h));
$this->assertSame("{\n \"SER", fread($h, 10));
$this->assertSame('VER_PROTOCOL', fread($h, 12));
$this->assertFalse(feof($h));
}

public function testToStream404()
{
$client = $this->getHttpClient(__FUNCTION__);
Expand Down

0 comments on commit 3c30754

Please sign in to comment.