@@ -41,6 +41,7 @@ static HashTable *global_class_table = NULL;
4141static HashTable * global_constants_table = NULL ;
4242static HashTable * global_auto_globals_table = NULL ;
4343static HashTable * global_persistent_list = NULL ;
44+ static zend_uintptr_t global_last_static_member = 0 ;
4445ZEND_TSRMLS_CACHE_DEFINE ()
4546# define GLOBAL_FUNCTION_TABLE global_function_table
4647# define GLOBAL_CLASS_TABLE global_class_table
@@ -630,9 +631,9 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{
630631 zend_hash_init_ex (compiler_globals -> auto_globals , 8 , NULL , auto_global_dtor , 1 , 0 );
631632 zend_hash_copy (compiler_globals -> auto_globals , global_auto_globals_table , auto_global_copy_ctor );
632633
633- compiler_globals -> last_static_member = zend_hash_num_elements ( compiler_globals -> class_table ) ;
634+ compiler_globals -> last_static_member = global_last_static_member ;
634635 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 * ));
636637 } else {
637638 compiler_globals -> static_members_table = NULL ;
638639 }
@@ -935,6 +936,7 @@ int zend_post_startup(void) /* {{{ */
935936 * GLOBAL_FUNCTION_TABLE = * compiler_globals -> function_table ;
936937 * GLOBAL_CLASS_TABLE = * compiler_globals -> class_table ;
937938 * GLOBAL_CONSTANTS_TABLE = * executor_globals -> zend_constants ;
939+ global_last_static_member = compiler_globals -> last_static_member ;
938940
939941 short_tags_default = CG (short_tags );
940942 compiler_options_default = CG (compiler_options );
@@ -1083,6 +1085,14 @@ ZEND_API void zend_activate(void) /* {{{ */
10831085}
10841086/* }}} */
10851087
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+
10861096void zend_call_destructors (void ) /* {{{ */
10871097{
10881098 zend_try {
0 commit comments