From: Michael Wallner Date: Thu, 28 Feb 2019 09:15:30 +0000 (+0100) Subject: PHP-7.4 compatibility X-Git-Tag: RELEASE_3_2_1~26 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=6365a4132b55ed5f253427f85c6c4b2937ba2a21;p=m6w6%2Fext-http PHP-7.4 compatibility --- diff --git a/src/php_http_message.c b/src/php_http_message.c index a2c42a2..f5e99a4 100644 --- a/src/php_http_message.c +++ b/src/php_http_message.c @@ -510,7 +510,8 @@ zend_class_entry *php_http_message_get_class_entry(void) } static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *rv); -static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot); + +static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot); static zend_object_handlers php_http_message_object_handlers; static HashTable php_http_message_object_prophandlers; @@ -923,7 +924,7 @@ static zval *php_http_message_object_read_prop(zval *object, zval *member, int t return return_value; } -static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot) +static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot) { php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); php_http_message_object_prophandler_t *handler; @@ -938,6 +939,7 @@ static void php_http_message_object_write_prop(zval *object, zval *member, zval } zend_string_release(member_name); + PHP_WRITE_PROP_HANDLER_RETURN(value); } static HashTable *php_http_message_object_get_debug_info(zval *object, int *is_temp) diff --git a/src/php_http_misc.h b/src/php_http_misc.h index 35de35e..b91638e 100644 --- a/src/php_http_misc.h +++ b/src/php_http_misc.h @@ -99,7 +99,11 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i #if PHP_DEBUG # undef HASH_OF -# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL)))) +# if PHP_VERSION_ID >= 70500 +# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL)))) +# else +# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL)))) +# endif #endif #ifndef GC_SET_REFCOUNT @@ -128,6 +132,14 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i # define HT_UNPROTECT_RECURSION(ht) GC_UNPROTECT_RECURSION(ht) #endif +#if PHP_VERSION_ID >= 70400 +# define PHP_WRITE_PROP_HANDLER_TYPE zval * +# define PHP_WRITE_PROP_HANDLER_RETURN(v) return v +#else +# define PHP_WRITE_PROP_HANDLER_TYPE void +# define PHP_WRITE_PROP_HANDLER_RETURN(v) +#endif + static inline void *PHP_HTTP_OBJ(zend_object *zo, zval *zv) { if (!zo) {