Skip to content

Commit 4c83ecc

Browse files
committed
Fixed bug #62912 (CURLINFO_PRIMARY_IP is not exposed)
CURLINFO_PRIMARY_* and CURLINFO_LOCAL_* where available in curl_getinfo but the constant itself was not exposed to php userland
1 parent 2c74536 commit 4c83ecc

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ PHP NEWS
2222
constructor). (Stas)
2323

2424
- CURL:
25+
. Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed).
26+
(Pierrick)
2527
. Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
2628

2729
- DateTime:

ext/curl/interface.c

+13-3
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,14 @@ PHP_MINIT_FUNCTION(curl)
713713
#if LIBCURL_VERSION_NUM >= 0x071202
714714
REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_URL);
715715
#endif
716+
#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */
717+
REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP);
718+
#endif
719+
#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */
720+
REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_PORT);
721+
REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_IP);
722+
REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_PORT);
723+
#endif
716724

717725

718726
/* cURL protocol constants (curl_version) */
@@ -2447,6 +2455,8 @@ PHP_FUNCTION(curl_getinfo)
24472455
create_certinfo(ci, listcode TSRMLS_CC);
24482456
CAAZ("certinfo", listcode);
24492457
}
2458+
#endif
2459+
#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */
24502460
if (curl_easy_getinfo(ch->cp, CURLINFO_PRIMARY_IP, &s_code) == CURLE_OK) {
24512461
CAAS("primary_ip", s_code);
24522462
}
@@ -2473,10 +2483,10 @@ PHP_FUNCTION(curl_getinfo)
24732483
} else {
24742484
switch (option) {
24752485
/* string variable types */
2476-
#if LIBCURL_VERSION_NUM >= 0x071500
2486+
#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */
24772487
case CURLINFO_PRIMARY_IP:
24782488
#endif
2479-
#if LIBCURL_VERSION_NUM >= 0x071500
2489+
#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */
24802490
case CURLINFO_LOCAL_IP:
24812491
#endif
24822492
case CURLINFO_PRIVATE:
@@ -2496,7 +2506,7 @@ PHP_FUNCTION(curl_getinfo)
24962506
break;
24972507
}
24982508
/* Long variable types */
2499-
#if LIBCURL_VERSION_NUM >= 0x071500
2509+
#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */
25002510
case CURLINFO_PRIMARY_PORT:
25012511
case CURLINFO_LOCAL_PORT:
25022512
#endif

0 commit comments

Comments
 (0)