PHP-7.4 compatibility
authorMichael Wallner <mike@php.net>
Thu, 28 Feb 2019 09:15:30 +0000 (10:15 +0100)
committerMichael Wallner <mike@php.net>
Thu, 28 Feb 2019 09:18:56 +0000 (10:18 +0100)
src/php_http_message.c
src/php_http_misc.h

index a2c42a2b15e5f1bcffe7fe1ac91b55d12e1ddad1..f5e99a469029c01efff643952f851d33c4464e3a 100644 (file)
@@ -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 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;
 
 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;
 }
 
        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;
 {
        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);
        }
 
        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)
 }
 
 static HashTable *php_http_message_object_get_debug_info(zval *object, int *is_temp)
index 35de35ef385428be67f4949955148322d2adcd33..b91638e2098f27abb48c1abdd0bc53be3f58541a 100644 (file)
@@ -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
 
 #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
 #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
 
 #      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) {
 static inline void *PHP_HTTP_OBJ(zend_object *zo, zval *zv)
 {
        if (!zo) {