Fixed bug #71929 (CURLINFO_CERTINFO data parsing error).
authorPierrick Charron <pierrick@php.net>
Thu, 28 Jul 2016 03:30:20 +0000 (23:30 -0400)
committerPierrick Charron <pierrick@php.net>
Thu, 28 Jul 2016 03:30:20 +0000 (23:30 -0400)
NEWS
UPGRADING
ext/curl/interface.c

diff --git a/NEWS b/NEWS
index 04f89c409a0a41114292fadff362f68f914a49fc..6c22dd9d74d4a28e8517d8aaa2426d944af6edd7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ PHP                                                                        NEWS
 - Curl:
   . Fixed bug #71144 (Segmentation fault when using cURL with ZTS).
     (maroszek at gmx dot net)
+  . Fixed bug #71929 (Certification information (CERTINFO) data parsing error).
+    (Pierrick)
 
 - Date:
   . Fixed bug #66836 (DateTime::createFromFormat 'U' with pre 1970 dates fails
index dbf65015de67cf17b1533578c9ff073f3caa8136..353ffa73ad0396659f357901f79f52e60397ba26 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -218,6 +218,9 @@ PHP 5.6 UPGRADE NOTES
     . CURLOPT_KRBLEVEL
     . CURLOPT_KRB4LEVEL
 
+  curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
+  as a string (PHP >= 5.6.25)
+
 - Strings:
   substr_compare() now allows $length to be zero.
   pack() and unpack() now support 64-bit format specifiers: q, Q, J and P.
index dc4a97197eb76852f6c8deff159eda14c6f5740d..c7112a091a04f53a42e4a8e47de0bdf5bc2d572e 100644 (file)
@@ -1833,38 +1833,6 @@ static void alloc_curl_handle(php_curl **ch)
 /* }}} */
 
 #if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
-/* {{{ split_certinfo
- */
-static void split_certinfo(char *string, zval *hash)
-{
-       char *org = estrdup(string);
-       char *s = org;
-       char *split;
-
-       if(org) {
-               do {
-                       char *key;
-                       char *val;
-                       char *tmp;
-
-                       split = strstr(s, "; ");
-                       if(split)
-                               *split = '\0';
-
-                       key = s;
-                       tmp = memchr(key, '=', 64);
-                       if(tmp) {
-                               *tmp = '\0';
-                               val = tmp+1;
-                               add_assoc_string(hash, key, val, 1);
-                       }
-                       s = split+2;
-               } while(split);
-               efree(org);
-       }
-}
-/* }}} */
-
 /* {{{ create_certinfo
  */
 static void create_certinfo(struct curl_certinfo *ci, zval *listcode TSRMLS_DC)
@@ -1888,17 +1856,7 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode TSRMLS_DC)
                                if(tmp) {
                                        *tmp = '\0';
                                        len = strlen(s);
-                                       if(!strcmp(s, "Subject") || !strcmp(s, "Issuer")) {
-                                               zval *hash;
-
-                                               MAKE_STD_ZVAL(hash);
-                                               array_init(hash);
-
-                                               split_certinfo(&slist->data[len+1], hash);
-                                               add_assoc_zval(certhash, s, hash);
-                                       } else {
-                                               add_assoc_string(certhash, s, &slist->data[len+1], 1);
-                                       }
+                                       add_assoc_string(certhash, s, &slist->data[len+1], 1);
                                } else {
                                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not extract hash key from certificate info");
                                }