Skip to content

Commit 6660946

Browse files
[5.1]Fix missing struct members (#5528)
* Fix missing struct members * remove code
1 parent 9831457 commit 6660946

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

scripts/route.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export DOCKER_COMPOSE_VERSION="1.21.0"
66
[ -z "${SWOOLE_BRANCH}" ] && export SWOOLE_BRANCH="master"
77
[ -z "${SWOOLE_BUILD_DIR}" ] && export SWOOLE_BUILD_DIR=$(cd "$(dirname "$0")";cd ../;pwd)
88
[ -z "${PHP_VERSION_ID}" ] && export PHP_VERSION_ID=`php -r "echo PHP_VERSION_ID;"`
9-
if [ ${PHP_VERSION_ID} -lt 80300 ]; then
9+
if [ ${PHP_VERSION_ID} -lt 80400 ]; then
1010
export PHP_VERSION="`php -r "echo PHP_MAJOR_VERSION;"`.`php -r "echo PHP_MINOR_VERSION;"`"
1111
else
1212
export PHP_VERSION="rc"

thirdparty/php/curl/curl_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static inline php_curlsh *curl_share_from_obj(zend_object *obj) {
203203
}
204204

205205
#define Z_CURL_SHARE_P(zv) curl_share_from_obj(Z_OBJ_P(zv))
206-
void curl_multi_register_class(const zend_function_entry *method_entries);
206+
void swoole_curl_multi_register_handlers(void);
207207
curl_result_t swoole_curl_cast_object(zend_object *obj, zval *result, int type);
208208

209209
php_curl *swoole_curl_get_handle(zval *zid, bool exclusive = true, bool required = true);

thirdparty/php/curl/interface.cc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ void swoole_native_curl_minit(int module_number) {
261261
}
262262
swoole_coroutine_curl_handle_ce = curl_ce;
263263
swoole_coroutine_curl_handle_ce->create_object = swoole_curl_create_object;
264+
#if PHP_VERSION_ID >= 80300
265+
swoole_coroutine_curl_handle_ce->default_object_handlers = &swoole_coroutine_curl_handle_handlers;
266+
#endif
264267
memcpy(&swoole_coroutine_curl_handle_handlers, &std_object_handlers, sizeof(zend_object_handlers));
265268
swoole_coroutine_curl_handle_handlers.offset = XtOffsetOf(php_curl, std);
266269
swoole_coroutine_curl_handle_handlers.free_obj = swoole_curl_free_obj;
@@ -274,7 +277,7 @@ void swoole_native_curl_minit(int module_number) {
274277

275278
zend_declare_property_null(swoole_coroutine_curl_handle_ce, ZEND_STRL("private_data"), ZEND_ACC_PUBLIC);
276279

277-
curl_multi_register_class(nullptr);
280+
swoole_curl_multi_register_handlers();
278281

279282
zend_unregister_functions(swoole_native_curl_functions, -1, CG(function_table));
280283
zend_register_functions(NULL, swoole_native_curl_functions, NULL, MODULE_PERSISTENT);
@@ -293,7 +296,9 @@ static zend_object *swoole_curl_create_object(zend_class_entry *class_type) {
293296

294297
zend_object_std_init(&intern->std, class_type);
295298
object_properties_init(&intern->std, class_type);
299+
#if PHP_VERSION_ID < 80300
296300
intern->std.handlers = &swoole_coroutine_curl_handle_handlers;
301+
#endif
297302

298303
return &intern->std;
299304
}
@@ -907,10 +912,6 @@ void swoole_curl_init_handle(php_curl *ch) {
907912
zend_llist_init(&ch->to_free->post, sizeof(struct HttpPost *), (llist_dtor_func_t) curl_free_post, 0);
908913
zend_llist_init(&ch->to_free->stream, sizeof(struct mime_data_cb_arg *), (llist_dtor_func_t) curl_free_cb_arg, 0);
909914

910-
#if LIBCURL_VERSION_NUM < 0x073800 && PHP_VERSION_ID >= 80100
911-
zend_llist_init(&ch->to_free->buffers, sizeof(zend_string *), (llist_dtor_func_t)curl_free_buffers, 0);
912-
#endif
913-
914915
ch->to_free->slist = (HashTable *) emalloc(sizeof(HashTable));
915916
zend_hash_init(ch->to_free->slist, 4, NULL, curl_free_slist, 0);
916917
ZVAL_UNDEF(&ch->postfields);
@@ -2444,10 +2445,6 @@ static void _php_curl_free(php_curl *ch) {
24442445
if (--(*ch->clone) == 0) {
24452446
#if PHP_VERSION_ID < 80100
24462447
zend_llist_clean(&ch->to_free->str);
2447-
#else
2448-
#if LIBCURL_VERSION_NUM < 0x073800 /* 7.56.0 */
2449-
zend_llist_clean(&ch->to_free->buffers);
2450-
#endif
24512448
#endif
24522449
zend_llist_clean(&ch->to_free->post);
24532450
zend_llist_clean(&ch->to_free->stream);

thirdparty/php/curl/multi.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ static zend_object *swoole_curl_multi_create_object(zend_class_entry *class_type
551551

552552
zend_object_std_init(&intern->std, class_type);
553553
object_properties_init(&intern->std, class_type);
554+
#if PHP_VERSION_ID < 80300
554555
intern->std.handlers = &swoole_coroutine_curl_multi_handle_handlers;
556+
#endif
555557

556558
return &intern->std;
557559
}
@@ -600,9 +602,12 @@ static HashTable *swoole_curl_multi_get_gc(zend_object *object, zval **table, in
600602
return zend_std_get_properties(object);
601603
}
602604

603-
void curl_multi_register_class(const zend_function_entry *method_entries) {
605+
void swoole_curl_multi_register_handlers(void) {
604606
swoole_coroutine_curl_multi_handle_ce = curl_multi_ce;
605607
swoole_coroutine_curl_multi_handle_ce->create_object = swoole_curl_multi_create_object;
608+
#if PHP_VERSION_ID >= 80300
609+
swoole_coroutine_curl_multi_handle_ce->default_object_handlers = &swoole_coroutine_curl_multi_handle_handlers;
610+
#endif
606611

607612
memcpy(&swoole_coroutine_curl_multi_handle_handlers, &std_object_handlers, sizeof(zend_object_handlers));
608613
swoole_coroutine_curl_multi_handle_handlers.offset = XtOffsetOf(php_curlm, std);

0 commit comments

Comments
 (0)