Skip to content

Commit 40a6626

Browse files
committed
Fixed compilation on PHP 8.3-dev (php/php-src@b0d8c10)
1 parent 4e874bb commit 40a6626

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/prepare.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -770,29 +770,41 @@ static inline void pmmpthread_prepare_constants(const pmmpthread_ident_t* source
770770
zend_string *name;
771771

772772
ZEND_HASH_FOREACH_STR_KEY_PTR(PMMPTHREAD_EG(source->ls, zend_constants), name, zconstant) {
773+
#if PHP_VERSION_ID < 80300
773774
if (zconstant->name) {
775+
#endif
774776
if (Z_TYPE(zconstant->value) == IS_RESOURCE){
775777
//we can't copy these
776778
continue;
777779
} else {
778780
zend_constant constant;
779781

780782
if (!pmmpthread_constant_exists(name)) {
781-
constant.name = pmmpthread_copy_string(name);
783+
zend_string *name_copy = pmmpthread_copy_string(name);
784+
#if PHP_VERSION_ID < 80300
785+
constant.name = name_copy;
786+
#endif
782787

783788
if (pmmpthread_copy_zval(source, &constant.value, &zconstant->value) != SUCCESS) {
784789
zend_error_noreturn(
785790
E_CORE_ERROR,
786791
"pmmpthread encountered an unknown non-copyable constant %s of type %s",
787-
ZSTR_VAL(zconstant->name),
792+
ZSTR_VAL(name_copy),
788793
zend_zval_type_name(&zconstant->value)
789794
);
790795
}
791796
ZEND_CONSTANT_SET_FLAGS(&constant, ZEND_CONSTANT_FLAGS(zconstant), ZEND_CONSTANT_MODULE_NUMBER(zconstant));
792-
zend_register_constant(&constant);
797+
zend_register_constant(
798+
#if PHP_VERSION_ID >= 80300
799+
name_copy,
800+
#endif
801+
&constant
802+
);
793803
}
794804
}
805+
#if PHP_VERSION_ID < 80300
795806
}
807+
#endif
796808
} ZEND_HASH_FOREACH_END();
797809
} /* }}} */
798810

0 commit comments

Comments
 (0)