summaryrefslogtreecommitdiffstats
path: root/openswoole-oldcurl.patch
blob: ef592c0c32d6ea2b426a5a35de6e6292c03a1c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From b0afb66e8d74eeadf0bff02098a1fe154087377c Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 20 Dec 2021 08:38:43 +0100
Subject: [PATCH] fix build with old libcurl

---
 thirdparty/php/curl/interface.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/thirdparty/php/curl/interface.cc b/thirdparty/php/curl/interface.cc
index 6af19e0dc..c1d7f748e 100644
--- a/thirdparty/php/curl/interface.cc
+++ b/thirdparty/php/curl/interface.cc
@@ -381,7 +381,9 @@ static zend_function *swoole_curl_get_constructor(zend_object *object) {
 static zend_object *swoole_curl_clone_obj(zend_object *object) {
     php_curl *ch;
     CURL *cp;
+#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
     zval *postfields;
+#endif
     zend_object *clone_object;
     php_curl *clone_ch;
 
@@ -399,6 +401,7 @@ static zend_object *swoole_curl_clone_obj(zend_object *object) {
     clone_ch->cp = cp;
     swoole_setup_easy_copy_handlers(clone_ch, ch);
 
+#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
     postfields = &clone_ch->postfields;
     if (Z_TYPE_P(postfields) != IS_UNDEF) {
         if (build_mime_structure_from_hash(clone_ch, postfields) != SUCCESS) {
@@ -406,6 +409,7 @@ static zend_object *swoole_curl_clone_obj(zend_object *object) {
             return &clone_ch->std;
         }
     }
+#endif
 
     return &clone_ch->std;
 }
@@ -415,7 +419,9 @@ static HashTable *swoole_curl_get_gc(zend_object *object, zval **table, int *n)
 
     zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create();
 
+#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
     zend_get_gc_buffer_add_zval(gc_buffer, &curl->postfields);
+#endif
     if (curl_handlers(curl)) {
         if (curl_handlers(curl)->read) {
             zend_get_gc_buffer_add_zval(gc_buffer, &curl_handlers(curl)->read->func_name);
@@ -2835,7 +2841,9 @@ static void _php_curl_free(php_curl *ch) {
     efree(ch->handlers);
 #endif
 
+#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
     zval_ptr_dtor(&ch->postfields);
+#endif
 
 #if PHP_VERSION_ID >= 80100
     zval_ptr_dtor(&ch->private_data);