@@ -41,6 +41,7 @@ static HashTable *global_class_table = NULL;
41
41
static HashTable * global_constants_table = NULL ;
42
42
static HashTable * global_auto_globals_table = NULL ;
43
43
static HashTable * global_persistent_list = NULL ;
44
+ static zend_uintptr_t global_last_static_member = 0 ;
44
45
ZEND_TSRMLS_CACHE_DEFINE ()
45
46
# define GLOBAL_FUNCTION_TABLE global_function_table
46
47
# define GLOBAL_CLASS_TABLE global_class_table
@@ -630,9 +631,9 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{
630
631
zend_hash_init_ex (compiler_globals -> auto_globals , 8 , NULL , auto_global_dtor , 1 , 0 );
631
632
zend_hash_copy (compiler_globals -> auto_globals , global_auto_globals_table , auto_global_copy_ctor );
632
633
633
- compiler_globals -> last_static_member = zend_hash_num_elements ( compiler_globals -> class_table ) ;
634
+ compiler_globals -> last_static_member = global_last_static_member ;
634
635
if (compiler_globals -> last_static_member ) {
635
- compiler_globals -> static_members_table = calloc (compiler_globals -> last_static_member , sizeof (zval * ));
636
+ compiler_globals -> static_members_table = calloc (compiler_globals -> last_static_member + 1 , sizeof (zval * ));
636
637
} else {
637
638
compiler_globals -> static_members_table = NULL ;
638
639
}
@@ -935,6 +936,7 @@ int zend_post_startup(void) /* {{{ */
935
936
* GLOBAL_FUNCTION_TABLE = * compiler_globals -> function_table ;
936
937
* GLOBAL_CLASS_TABLE = * compiler_globals -> class_table ;
937
938
* GLOBAL_CONSTANTS_TABLE = * executor_globals -> zend_constants ;
939
+ global_last_static_member = compiler_globals -> last_static_member ;
938
940
939
941
short_tags_default = CG (short_tags );
940
942
compiler_options_default = CG (compiler_options );
@@ -1083,6 +1085,14 @@ ZEND_API void zend_activate(void) /* {{{ */
1083
1085
}
1084
1086
/* }}} */
1085
1087
1088
+ #ifdef ZTS
1089
+ void zend_reset_internal_classes (void ) /* {{{ */
1090
+ {
1091
+ CG (last_static_member ) = global_last_static_member ;
1092
+ }
1093
+ /* }}} */
1094
+ #endif
1095
+
1086
1096
void zend_call_destructors (void ) /* {{{ */
1087
1097
{
1088
1098
zend_try {
0 commit comments