diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 334dfd7..3fe29ec 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -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); diff --git a/src/Curl/MultiCurl.php b/src/Curl/MultiCurl.php index 13b9f8c..ee0e42b 100755 --- a/src/Curl/MultiCurl.php +++ b/src/Curl/MultiCurl.php @@ -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); diff --git a/src/Curl/Url.php b/src/Curl/Url.php index d811fc9..227d21b 100644 --- a/src/Curl/Url.php +++ b/src/Curl/Url.php @@ -194,7 +194,7 @@ class Url // $7 = (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'] !== '') { diff --git a/tests/PHPCurlClass/Helper.php b/tests/PHPCurlClass/Helper.php index 79ded31..ac6eeaf 100644 --- a/tests/PHPCurlClass/Helper.php +++ b/tests/PHPCurlClass/Helper.php @@ -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; } diff --git a/tests/PHPCurlClass/PHPMultiCurlClassTest.php b/tests/PHPCurlClass/PHPMultiCurlClassTest.php index 92bf42c..a43d4d2 100644 --- a/tests/PHPCurlClass/PHPMultiCurlClassTest.php +++ b/tests/PHPCurlClass/PHPMultiCurlClassTest.php @@ -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; } diff --git a/tests/PHPCurlClass/server.php b/tests/PHPCurlClass/server.php index 2f75d20..62a6ad9 100644 --- a/tests/PHPCurlClass/server.php +++ b/tests/PHPCurlClass/server.php @@ -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; }