[php-src] PR #18984: Add support for CURLINFO_CONN_ID in curl_getinfo()
| From: | thecaliskan | Date: | Mon, 30 Jun 2025 19:32:25 +0000 |
| Subject: | [php-src] PR #18984: Add support for CURLINFO_CONN_ID in curl_getinfo() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-32260@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18984
Author: thecaliskan
# Add support for CURLINFO_CONN_ID in curl_getinfo()
## Summary
This patch adds support for the
CURLINFO_CONN_ID constant in the
curl_getinfo() function when compiled with **libcurl >= 8.2.0**.
CURLINFO_CONN_ID allows retrieving the unique identifier of the underlying connection
used in the most recent transfer. This is useful for advanced features like connection reuse
tracking, diagnostics, or connection pooling implementations at the PHP level.
---
## Details
- Introduced support for curl_getinfo($ch, CURLINFO_CONN_ID) when available.
- Added "conn_id" key to the associative array returned by
curl_getinfo($ch) if applicable.
- A SKIPIF check ensures that the test is skipped if the libcurl version is too old.
- Includes a .phpt test file:
ext/curl/tests/curl_getinfo_CURLINFO_CONN_ID.phpt.
---
## Requirements
- Requires **libcurl version 8.2.0 or higher**.
- PHP runtime will fallback silently if the constant is not available in the underlying libcurl.
---
## Example usage
```php
$ch = curl_init("https://example.com");
curl_exec($ch);
$connId = curl_getinfo($ch, CURLINFO_CONN_ID);
echo "Connection ID: $connId\n";