1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Zend: use type uint32_t for default_static_members_count CE field

This commit is contained in:
Gina Peter Banyard
2025-10-03 16:37:17 +01:00
parent 51a4e06b08
commit 40a42cffd8
4 changed files with 4 additions and 8 deletions

View File

@@ -157,7 +157,7 @@ struct _zend_class_entry {
uint32_t ce_flags2;
int default_properties_count;
int default_static_members_count;
uint32_t default_static_members_count;
zval *default_properties_table;
zval *default_static_members_table;
ZEND_MAP_PTR_DEF(zval *, static_members_table);

View File

@@ -2006,7 +2006,6 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
ZEND_API void zend_class_init_statics(zend_class_entry *class_type) /* {{{ */
{
int i;
zval *p;
if (class_type->default_static_members_count && !CE_STATIC_MEMBERS(class_type)) {
@@ -2015,7 +2014,7 @@ ZEND_API void zend_class_init_statics(zend_class_entry *class_type) /* {{{ */
}
ZEND_MAP_PTR_SET(class_type->static_members_table, emalloc(sizeof(zval) * class_type->default_static_members_count));
for (i = 0; i < class_type->default_static_members_count; i++) {
for (uint32_t i = 0; i < class_type->default_static_members_count; i++) {
p = &class_type->default_static_members_table[i];
if (Z_TYPE_P(p) == IS_INDIRECT) {
zval *q = &CE_STATIC_MEMBERS(class_type->parent)[i];

View File

@@ -967,12 +967,11 @@ zend_class_entry *zend_persist_class_entry(zend_class_entry *orig_ce)
}
}
if (ce->default_static_members_table) {
int i;
ce->default_static_members_table = zend_shared_memdup_free(ce->default_static_members_table, sizeof(zval) * ce->default_static_members_count);
/* Persist only static properties in this class.
* Static properties from parent classes will be handled in class_copy_ctor and are marked with IS_INDIRECT */
for (i = 0; i < ce->default_static_members_count; i++) {
for (uint32_t i = 0; i < ce->default_static_members_count; i++) {
if (Z_TYPE(ce->default_static_members_table[i]) != IS_INDIRECT) {
zend_persist_zval(&ce->default_static_members_table[i]);
}

View File

@@ -479,10 +479,8 @@ void zend_persist_class_entry_calc(zend_class_entry *ce)
}
}
if (ce->default_static_members_table) {
int i;
ADD_SIZE(sizeof(zval) * ce->default_static_members_count);
for (i = 0; i < ce->default_static_members_count; i++) {
for (uint32_t i = 0; i < ce->default_static_members_count; i++) {
if (Z_TYPE(ce->default_static_members_table[i]) != IS_INDIRECT) {
zend_persist_zval_calc(&ce->default_static_members_table[i]);
}