mirror of
https://github.com/php/php-src.git
synced 2026-04-08 08:33:06 +02:00
Fix function copying in ZTS
Still doesn't entirely work :/
This commit is contained in:
10
Zend/zend.c
10
Zend/zend.c
@@ -515,13 +515,21 @@ static void zend_init_exception_op(TSRMLS_D) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
#ifdef ZTS
|
||||
static void function_copy_ctor(zval *zv)
|
||||
{
|
||||
zend_function *old_func = Z_FUNC_P(zv);
|
||||
Z_FUNC_P(zv) = pemalloc(sizeof(zend_internal_function), 1);
|
||||
memcpy(Z_FUNC_P(zv), old_func, sizeof(zend_internal_function));
|
||||
function_add_ref(Z_FUNC_P(zv));
|
||||
}
|
||||
|
||||
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
compiler_globals->compiled_filename = NULL;
|
||||
|
||||
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->function_table, global_function_table, NULL);
|
||||
zend_hash_copy(compiler_globals->function_table, global_function_table, function_copy_ctor);
|
||||
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
|
||||
@@ -3093,6 +3093,10 @@ ZEND_API void function_add_ref(zend_function *function) /* {{{ */
|
||||
zend_hash_copy(op_array->static_variables, static_variables, zval_add_ref_unref);
|
||||
}
|
||||
op_array->run_time_cache = NULL;
|
||||
} else if (function->type == ZEND_INTERNAL_FUNCTION) {
|
||||
if (function->common.function_name) {
|
||||
STR_ADDREF(function->common.function_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -6951,10 +6955,10 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
|
||||
if (CG(static_members_table) && n >= CG(last_static_member)) {
|
||||
/* Support for run-time declaration: dl() */
|
||||
CG(last_static_member) = n+1;
|
||||
CG(static_members_table) = realloc(CG(static_members_table), (n+1)*sizeof(zval**));
|
||||
CG(static_members_table) = realloc(CG(static_members_table), (n+1)*sizeof(zval*));
|
||||
CG(static_members_table)[n] = NULL;
|
||||
}
|
||||
ce->static_members_table = (zval**)(zend_intptr_t)n;
|
||||
ce->static_members_table = (zval*)(zend_intptr_t)n;
|
||||
#else
|
||||
ce->static_members_table = NULL;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user