Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 775306a

Browse filesBrowse files
committed
bug #42769 [HttpClient] Don't pass float to usleep() (derrabus)
This PR was merged into the 5.3 branch. Discussion ---------- [HttpClient] Don't pass float to `usleep()` | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Part of #41552 | License | MIT | Doc PR | N/A When we pass a float value to `usleep()`, PHP 8.1 will trigger a deprecation warning: > Implicit conversion from float 999967.098236084 to int loses precision This PR makes the cast explicit and fixes the failing test. Commits ------- 33424ab [HttpClient] Don't pass float to usleep()
2 parents fa2ae46 + 33424ab commit 775306a
Copy full SHA for 775306a

File tree

2 files changed

+2
-2
lines changed
Filter options

2 files changed

+2
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/Response/CurlResponse.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ private static function select(ClientState $multi, float $timeout): int
353353
}
354354

355355
if ($multi->pauseExpiries && 0 < $timeout -= microtime(true) - $now) {
356-
usleep(1E6 * $timeout);
356+
usleep((int) (1E6 * $timeout));
357357
}
358358

359359
return 0;

‎src/Symfony/Component/HttpClient/Response/NativeResponse.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/Response/NativeResponse.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ private static function select(ClientState $multi, float $timeout): int
366366
}
367367

368368
if (!$handles) {
369-
usleep(1E6 * $timeout);
369+
usleep((int) (1E6 * $timeout));
370370

371371
return 0;
372372
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.