Skip to content

Commit 7af4a8d

Browse files
committed
Fix some errors caused by using strict types
1 parent bb1a190 commit 7af4a8d

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/Curl/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,7 @@ private function downloadComplete($fh)
18841884
*/
18851885
private function parseHeaders($raw_headers)
18861886
{
1887-
$raw_headers = preg_split('/\r\n/', $raw_headers, null, PREG_SPLIT_NO_EMPTY);
1887+
$raw_headers = preg_split('/\r\n/', (string) $raw_headers, -1, PREG_SPLIT_NO_EMPTY);
18881888
$http_headers = new CaseInsensitiveArray();
18891889

18901890
$raw_headers_count = count($raw_headers);

src/Curl/MultiCurl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ private function waitUntilRequestQuotaAvailable()
12701270
$sleep_seconds = $sleep_until - microtime(true);
12711271

12721272
// Avoid using time_sleep_until() as it appears to be less precise and not sleep long enough.
1273-
usleep($sleep_seconds * 1000000);
1273+
usleep((int) $sleep_seconds * 1000000);
12741274

12751275
// Ensure that enough time has passed as usleep() may not have waited long enough.
12761276
$this->currentStartTime = microtime(true);

src/Curl/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private function parseUrl($url)
194194
// $7 = <undefined> (query)
195195
// $8 = #Related (ignore)
196196
// $9 = Related (fragment)
197-
preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/', $url, $output_array);
197+
preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/', (string) $url, $output_array);
198198

199199
$parts = [];
200200
if (isset($output_array['1']) && $output_array['1'] !== '') {

tests/PHPCurlClass/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function get_tmp_file_path()
103103
// Return temporary file path without creating file.
104104
$tmp_file_path =
105105
rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) .
106-
DIRECTORY_SEPARATOR . 'php-curl-class.' . uniqid(rand(), true);
106+
DIRECTORY_SEPARATOR . 'php-curl-class.' . uniqid((string) rand(), true);
107107
return $tmp_file_path;
108108
}
109109

tests/PHPCurlClass/PHPMultiCurlClassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2946,7 +2946,7 @@ public function testAddRequestAfterStart()
29462946
$urls = [];
29472947
$copy_of_urls = [];
29482948
for ($i = 0; $i < 10; $i++) {
2949-
$url = Test::TEST_URL . '?' . md5(mt_rand());
2949+
$url = Test::TEST_URL . '?' . md5((string) mt_rand());
29502950
$urls[] = $url;
29512951
$copy_of_urls[] = $url;
29522952
}

tests/PHPCurlClass/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
exit;
265265
} elseif ($test === 'download_file_size') {
266266
$bytes = isset($_GET['bytes']) ? $_GET['bytes'] : 1234;
267-
$str = str_repeat('.', $bytes);
267+
$str = str_repeat('.', (int) $bytes);
268268
header('Content-Type: application/octet-stream');
269269
header('Content-Length: ' . strlen($str));
270270
header('ETag: ' . md5($str));
@@ -292,7 +292,7 @@
292292
$dots_to_print = floor($elapsed) - $dots_printed;
293293

294294
if ($dots_to_print) {
295-
echo str_repeat('.', $dots_to_print);
295+
echo str_repeat('.', (int) $dots_to_print);
296296
$dots_printed += $dots_to_print;
297297
}
298298

0 commit comments

Comments
 (0)