Skip to content

Commit 5963699

Browse files
committed
* Fix CURL tests by removing deprecated curl_close() calls
Remove all curl_close() function calls from async extension CURL tests to eliminate deprecation warnings that were causing test failures. Since PHP 8.0, curl_close() has no effect as cURL resources are automatically freed when they go out of scope. In PHP 8.5, this function is marked as deprecated and outputs warnings. Changes: - Removed curl_close() calls from all 10 CURL test files in ext/async/tests/curl/ - Tests now pass without deprecation warnings - Maintains compatibility with modern PHP versions
1 parent f0bfea3 commit 5963699

10 files changed

+0
-19
lines changed

tests/curl/001-curl_exec_basic.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ function test_basic_get($server) {
3232
$total_time = curl_getinfo($ch, CURLINFO_TOTAL_TIME);
3333
$error = curl_error($ch);
3434

35-
curl_close($ch);
3635

3736
$duration = round(($end_time - $start_time) * 1000, 2);
3837

@@ -65,7 +64,6 @@ function test_json_endpoint($server) {
6564
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
6665
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
6766

68-
curl_close($ch);
6967

7068
echo "JSON HTTP Code: $http_code\n";
7169
echo "JSON Content-Type: $content_type\n";
@@ -92,7 +90,6 @@ function test_error_handling($server) {
9290
$response = curl_exec($ch);
9391
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
9492

95-
curl_close($ch);
9693

9794
echo "Error HTTP Code: $http_code\n";
9895
echo "Error Response: $response\n";

tests/curl/002-concurrent_requests.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function make_request($id, $server) {
2020
$response = curl_exec($ch);
2121
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
2222

23-
curl_close($ch);
2423

2524
return [
2625
'id' => $id,

tests/curl/003-multi_handle_async.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ function test_multi_handle($server) {
5757
curl_multi_remove_handle($mh, $ch3);
5858
curl_multi_close($mh);
5959

60-
curl_close($ch1);
61-
curl_close($ch2);
62-
curl_close($ch3);
6360

6461
echo "Response 1: $response1\n";
6562
echo "Response 2: $response2\n";

tests/curl/004-post_request.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function test_post_request($server) {
2727
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
2828
$error = curl_error($ch);
2929

30-
curl_close($ch);
3130

3231
echo "HTTP Code: $http_code\n";
3332
echo "Error: " . ($error ?: "none") . "\n";

tests/curl/005-error_handling.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function test_connection_error() {
2424
$error = curl_error($ch);
2525
$errno = curl_errno($ch);
2626

27-
curl_close($ch);
2827

2928
echo "Connection failed as expected\n";
3029
echo "Error present: " . (!empty($error) ? "yes" : "no") . "\n";
@@ -45,7 +44,6 @@ function test_server_error($server) {
4544
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
4645
$error = curl_error($ch);
4746

48-
curl_close($ch);
4947

5048
echo "HTTP Code: $http_code\n";
5149
echo "Error: " . ($error ?: "none") . "\n";
@@ -65,7 +63,6 @@ function test_not_found($server) {
6563
$response = curl_exec($ch);
6664
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
6765

68-
curl_close($ch);
6966

7067
echo "HTTP Code: $http_code\n";
7168
echo "Response length: " . strlen($response) . "\n";

tests/curl/006-timeout_handling.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function test_timeout() {
2828
$errno = curl_errno($ch);
2929
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
3030

31-
curl_close($ch);
3231

3332
$duration = $end_time - $start_time;
3433

@@ -52,7 +51,6 @@ function test_normal_request($server) {
5251
$response = curl_exec($ch);
5352
$error = curl_error($ch);
5453

55-
curl_close($ch);
5654

5755
echo "Response: $response\n";
5856
echo "Error: " . ($error ?: "none") . "\n";

tests/curl/007-large_response.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ function test_large_response($server) {
2323
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
2424
$error = curl_error($ch);
2525

26-
curl_close($ch);
2726

2827
echo "HTTP Code: $http_code\n";
2928
echo "Error: " . ($error ?: "none") . "\n";

tests/curl/008-mixed_sync_async.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function sync_request($server) {
2222
$response = curl_exec($ch);
2323
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
2424

25-
curl_close($ch);
2625

2726
echo "Sync request complete: HTTP $http_code\n";
2827
return $response;
@@ -39,7 +38,6 @@ function async_request($server) {
3938
$response = curl_exec($ch);
4039
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
4140

42-
curl_close($ch);
4341

4442
echo "Async request complete: HTTP $http_code\n";
4543
return $response;

tests/curl/009-curl_with_coroutines.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ function make_curl_request($server, $id) {
2121
$response = curl_exec($ch);
2222
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
2323

24-
curl_close($ch);
2524

2625
return [
2726
'id' => $id,

tests/curl/010-multi_select_async.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ function test_curl_multi($server) {
5151
curl_multi_remove_handle($mh, $ch2);
5252
curl_multi_close($mh);
5353

54-
curl_close($ch1);
55-
curl_close($ch2);
5654

5755
echo "Response 1: $response1\n";
5856
echo "Response 2: $response2\n";

0 commit comments

Comments
 (0)