Patch-Source: https://github.com/swoole/swoole-src/commit/e085097fb9001a3e8e78a47ca4541da2f675661c From e085097fb9001a3e8e78a47ca4541da2f675661c Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Fri, 5 Aug 2022 15:20:10 +0800 Subject: [PATCH] Fix compilation errors, add 8.2 to tests --- .github/workflows/test-linux.yml | 2 +- ext-src/swoole_event.cc | 2 +- thirdparty/php/curl/curl_private.h | 8 +++++++- thirdparty/php/curl/interface.cc | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/thirdparty/php/curl/curl_private.h b/thirdparty/php/curl/curl_private.h index 19ea94fcbd..2393b681af 100644 --- a/thirdparty/php/curl/curl_private.h +++ b/thirdparty/php/curl/curl_private.h @@ -180,6 +180,12 @@ static inline php_curl_handlers *curl_handlers(php_curl *ch) { } #endif +#if PHP_VERSION_ID >= 80200 +typedef zend_result curl_result_t; +#else +typedef int curl_result_t; +#endif + static inline php_curl *curl_from_obj(zend_object *obj) { return (php_curl *) ((char *) (obj) -XtOffsetOf(php_curl, std)); } @@ -192,7 +198,7 @@ static inline php_curlsh *curl_share_from_obj(zend_object *obj) { #define Z_CURL_SHARE_P(zv) curl_share_from_obj(Z_OBJ_P(zv)) void curl_multi_register_class(const zend_function_entry *method_entries); -int swoole_curl_cast_object(zend_object *obj, zval *result, int type); +curl_result_t swoole_curl_cast_object(zend_object *obj, zval *result, int type); php_curl *swoole_curl_get_handle(zval *zid, bool exclusive = true, bool required = true); diff --git a/thirdparty/php/curl/interface.cc b/thirdparty/php/curl/interface.cc index e6006748df..6b353883ab 100644 --- a/thirdparty/php/curl/interface.cc +++ b/thirdparty/php/curl/interface.cc @@ -387,7 +387,7 @@ static HashTable *swoole_curl_get_gc(zend_object *object, zval **table, int *n) return zend_std_get_properties(object); } -int swoole_curl_cast_object(zend_object *obj, zval *result, int type) { +curl_result_t swoole_curl_cast_object(zend_object *obj, zval *result, int type) { if (type == IS_LONG) { /* For better backward compatibility, make (int) $curl_handle return the object ID, * similar to how it previously returned the resource ID. */