10000 [HttpClient] workaround curl_multi_select() issue · symfony/symfony@e635491 · GitHub
[go: up one dir, main page]

Skip to content

Commit e635491

Browse files
[HttpClient] workaround curl_multi_select() issue
1 parent 927ae8a commit e635491

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ install:
4848
- php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
4949
- git config --global user.email ""
5050
- git config --global user.name "Symfony"
51-
- php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit
5251
- php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit src\Symfony\Contracts
5352
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
5453
- php composer.phar update --no-progress --no-suggest --ansi

src/Symfony/Component/HttpClient/Response/CurlResponse.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ private static function perform(CurlClientState $multi, array &$responses = null
274274
*/
275275
private static function select(CurlClientState $multi, float $timeout): int
276276
{
277+
if (\PHP_VERSION_ID < 70123 || (70200 <= \PHP_VERSION_ID && \PHP_VERSION_ID < 70211)) {
278+
// workaround https://bugs.php.net/76480
279+
$timeout = min($timeout, 0.01);
280+
}
281+
277282
return curl_multi_select($multi->handle, $timeout);
278283
}
279284

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,9 @@ public function testNotATimeout()
597597
{
598598
$client = $this->getHttpClient(__FUNCTION__);
599599
$response = $client->request('GET', 'http://localhost:8057/timeout-header', [
600-
'timeout' => 0.5,
600+
'timeout' => 0.9,
601601
]);
602-
usleep(510000);
602+
sleep(1);
603603
$this->assertSame(200, $response->getStatusCode());
604604
}
605605

0 commit comments

Comments
 (0)
0