typedef struct php_http_curle_storage {
char *url;
char *cookiestore;
+ CURLcode errorcode;
char errorbuffer[0x100];
} php_http_curle_storage_t;
#if PHP_HTTP_CURL_VERSION(7,34,0)
{
- int i;
zval *ti_array;
struct curl_tlssessioninfo *ti;
}
}
#endif
- add_assoc_string_ex(&array, "error", sizeof("error"), php_http_curle_get_storage(ch)->errorbuffer, 1);
+ {
+ php_http_curle_storage_t *st = php_http_curle_get_storage(ch);
+
+ add_assoc_long_ex(&array, "curlcode", sizeof("curlcode"), st->errorcode);
+ add_assoc_string_ex(&array, "error", sizeof("error"), st->errorbuffer, 1);
+ }
return SUCCESS;
}
if (msg && CURLMSG_DONE == msg->msg) {
if (CURLE_OK != msg->data.result) {
php_http_curle_storage_t *st = php_http_curle_get_storage(msg->easy_handle);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s; %s (%s)", curl_easy_strerror(msg->data.result), STR_PTR(st->errorbuffer), STR_PTR(st->url));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s; %s (%s)", curl_easy_strerror(st->errorcode = msg->data.result), STR_PTR(st->errorbuffer), STR_PTR(st->url));
}
if ((enqueue = php_http_client_enqueued(context, msg->easy_handle, compare_queue))) {