Skip to content

curl_close() deprecated in PHP 8.5 — triggers E_DEPRECATED #245

@adri

Description

@adri

Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0

How to reproduce

Run any query against ClickHouse on PHP 8.5:

$client = new ClickHouseDB\Client(['host' => 'localhost']);
$client->select('SELECT 1');
// E_DEPRECATED: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0

Suggested fix

Remove the curl_close() call entirely — it's been a no-op since PHP 8.0. If backward compatibility with PHP 7.x is needed, guard it:

 public function close()
 {
     if ($this->handle) {
-        curl_close($this->handle);
+        if (PHP_VERSION_ID < 80000) {
+            curl_close($this->handle);
+        }
     }
     $this->handle = null;
 }

Or simply:

 public function close()
 {
-    if ($this->handle) {
-        curl_close($this->handle);
-    }
     $this->handle = null;
 }

References

Environment

  • PHP 8.5.2
  • smi2/phpclickhouse 1.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions