Skip to content

Commit e3ef201

Browse files
committed
fix build with php 8
1 parent ec63358 commit e3ef201

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

msgpack_convert.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,15 @@ static inline int msgpack_convert_long_to_properties(HashTable *ht, zval *object
6464
*properties = NULL;
6565
}
6666
ZVAL_LONG(&key_zv, key_index);
67+
#if PHP_VERSION_ID < 80000
6768
zend_std_write_property(object, &key_zv, val, NULL);
69+
#else
70+
{
71+
zend_string *key = zval_get_string(&key_zv);
72+
zend_std_write_property(Z_OBJ_P(object), key, val, NULL);
73+
zend_string_release(key);
74+
}
75+
#endif
6876
return SUCCESS;
6977
}
7078
/* }}} */
@@ -87,7 +95,11 @@ static inline int msgpack_convert_string_to_properties(zval *object, zend_string
8795
zend_update_property_ex(ce, object, key, val);
8896
return_code = SUCCESS;
8997
} else {
98+
#if PHP_VERSION_ID < 80000
9099
zend_std_write_property(object, &pub_name, val, NULL);
100+
#else
101+
zend_std_write_property(Z_OBJ_P(object), key, val, NULL);
102+
#endif
91103
return_code = FAILURE;
92104
}
93105
zend_hash_add(var, Z_STR(pub_name), val);
@@ -358,7 +370,11 @@ int msgpack_convert_object(zval *return_value, zval *tpl, zval *value) /* {{{ */
358370
} ZEND_HASH_FOREACH_END();
359371

360372
/* index */
373+
#if PHP_VERSION_ID < 80000
361374
properties = Z_OBJ_HT_P(return_value)->get_properties(return_value);
375+
#else
376+
properties = Z_OBJ_HT_P(return_value)->get_properties(Z_OBJ_P(return_value));
377+
#endif
362378
if (HASH_OF(tpl)) {
363379
properties = HASH_OF(tpl);
364380
}
@@ -433,7 +449,11 @@ int msgpack_convert_object(zval *return_value, zval *tpl, zval *value) /* {{{ */
433449
HashTable *properties = NULL;
434450
HashPosition prop_pos;
435451

452+
#if PHP_VERSION_ID < 80000
436453
properties = Z_OBJ_HT_P(return_value)->get_properties(return_value);
454+
#else
455+
properties = Z_OBJ_HT_P(return_value)->get_properties(Z_OBJ_P(return_value));
456+
#endif
437457
zend_hash_internal_pointer_reset_ex(properties, &prop_pos);
438458

439459
if (msgpack_convert_long_to_properties(HASH_OF(return_value), return_value, &properties, &prop_pos, 0, value, NULL) != SUCCESS) {

0 commit comments

Comments
 (0)