Fix some errors caused by using strict types

This commit is contained in:
Zach Borboa
2021-07-26 10:08:44 -04:00
parent bb1a190071
commit 7af4a8d383
6 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -1884,7 +1884,7 @@ class Curl
*/
private function parseHeaders($raw_headers)
{
$raw_headers = preg_split('/\r\n/', $raw_headers, null, PREG_SPLIT_NO_EMPTY);
$raw_headers = preg_split('/\r\n/', (string) $raw_headers, -1, PREG_SPLIT_NO_EMPTY);
$http_headers = new CaseInsensitiveArray();
$raw_headers_count = count($raw_headers);
+1 -1
View File
@@ -1270,7 +1270,7 @@ class MultiCurl
$sleep_seconds = $sleep_until - microtime(true);
// Avoid using time_sleep_until() as it appears to be less precise and not sleep long enough.
usleep($sleep_seconds * 1000000);
usleep((int) $sleep_seconds * 1000000);
// Ensure that enough time has passed as usleep() may not have waited long enough.
$this->currentStartTime = microtime(true);
+1 -1
View File
@@ -194,7 +194,7 @@ class Url
// $7 = <undefined> (query)
// $8 = #Related (ignore)
// $9 = Related (fragment)
preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/', $url, $output_array);
preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/', (string) $url, $output_array);
$parts = [];
if (isset($output_array['1']) && $output_array['1'] !== '') {
+1 -1
View File
@@ -103,7 +103,7 @@ function get_tmp_file_path()
// Return temporary file path without creating file.
$tmp_file_path =
rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) .
DIRECTORY_SEPARATOR . 'php-curl-class.' . uniqid(rand(), true);
DIRECTORY_SEPARATOR . 'php-curl-class.' . uniqid((string) rand(), true);
return $tmp_file_path;
}
+1 -1
View File
@@ -2946,7 +2946,7 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
$urls = [];
$copy_of_urls = [];
for ($i = 0; $i < 10; $i++) {
$url = Test::TEST_URL . '?' . md5(mt_rand());
$url = Test::TEST_URL . '?' . md5((string) mt_rand());
$urls[] = $url;
$copy_of_urls[] = $url;
}
+2 -2
View File
@@ -264,7 +264,7 @@ if ($test === 'http_basic_auth') {
exit;
} elseif ($test === 'download_file_size') {
$bytes = isset($_GET['bytes']) ? $_GET['bytes'] : 1234;
$str = str_repeat('.', $bytes);
$str = str_repeat('.', (int) $bytes);
header('Content-Type: application/octet-stream');
header('Content-Length: ' . strlen($str));
header('ETag: ' . md5($str));
@@ -292,7 +292,7 @@ if ($test === 'http_basic_auth') {
$dots_to_print = floor($elapsed) - $dots_printed;
if ($dots_to_print) {
echo str_repeat('.', $dots_to_print);
echo str_repeat('.', (int) $dots_to_print);
$dots_printed += $dots_to_print;
}