mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Removed EG(active_symbol_table) and use corresponding value from EG(current_execute_data)
This commit is contained in:
parent
d2890963e4
commit
6bf24f4dd0
21 changed files with 251 additions and 199 deletions
10
Zend/zend.c
10
Zend/zend.c
|
@ -938,7 +938,6 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
|
||||||
{
|
{
|
||||||
/* we're no longer executing anything */
|
/* we're no longer executing anything */
|
||||||
EG(current_execute_data) = NULL;
|
EG(current_execute_data) = NULL;
|
||||||
EG(active_symbol_table) = NULL;
|
|
||||||
|
|
||||||
zend_try {
|
zend_try {
|
||||||
shutdown_scanner(TSRMLS_C);
|
shutdown_scanner(TSRMLS_C);
|
||||||
|
@ -1037,6 +1036,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||||
zend_stack declare_stack;
|
zend_stack declare_stack;
|
||||||
zend_stack list_stack;
|
zend_stack list_stack;
|
||||||
zend_stack context_stack;
|
zend_stack context_stack;
|
||||||
|
zend_array *symbol_table;
|
||||||
TSRMLS_FETCH();
|
TSRMLS_FETCH();
|
||||||
|
|
||||||
/* Report about uncaught exception in case of fatal errors */
|
/* Report about uncaught exception in case of fatal errors */
|
||||||
|
@ -1175,16 +1175,14 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||||
|
|
||||||
ZVAL_LONG(¶ms[3], error_lineno);
|
ZVAL_LONG(¶ms[3], error_lineno);
|
||||||
|
|
||||||
if (!EG(active_symbol_table)) {
|
symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* during shutdown the symbol table table can be still null */
|
/* during shutdown the symbol table table can be still null */
|
||||||
if (!EG(active_symbol_table)) {
|
if (!symbol_table) {
|
||||||
ZVAL_NULL(¶ms[4]);
|
ZVAL_NULL(¶ms[4]);
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NEW_ARR(¶ms[4]);
|
ZVAL_NEW_ARR(¶ms[4]);
|
||||||
zend_array_dup(Z_ARRVAL(params[4]), &EG(active_symbol_table)->ht);
|
zend_array_dup(Z_ARRVAL(params[4]), &symbol_table->ht);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
|
ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
|
||||||
|
|
|
@ -521,7 +521,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_lengt
|
||||||
|
|
||||||
ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC);
|
ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC);
|
||||||
|
|
||||||
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D);
|
ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D);
|
||||||
ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data);
|
ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data);
|
||||||
ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data);
|
ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data);
|
||||||
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC);
|
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC);
|
||||||
|
|
|
@ -1749,12 +1749,10 @@ ZEND_FUNCTION(get_defined_functions)
|
||||||
Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */
|
Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */
|
||||||
ZEND_FUNCTION(get_defined_vars)
|
ZEND_FUNCTION(get_defined_vars)
|
||||||
{
|
{
|
||||||
if (!EG(active_symbol_table)) {
|
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZVAL_NEW_ARR(return_value);
|
ZVAL_NEW_ARR(return_value);
|
||||||
zend_array_dup(Z_ARRVAL_P(return_value), &EG(active_symbol_table)->ht);
|
zend_array_dup(Z_ARRVAL_P(return_value), &symbol_table->ht);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
|
@ -1444,8 +1444,8 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of
|
||||||
|
|
||||||
#define CHECK_SYMBOL_TABLES() \
|
#define CHECK_SYMBOL_TABLES() \
|
||||||
zend_hash_apply(&EG(symbol_table), zend_check_symbol TSRMLS_CC); \
|
zend_hash_apply(&EG(symbol_table), zend_check_symbol TSRMLS_CC); \
|
||||||
if (&EG(symbol_table)!=EG(active_symbol_table)) { \
|
if (&EG(symbol_table)!=EX(symbol_table)) { \
|
||||||
zend_hash_apply(EG(active_symbol_table), zend_check_symbol TSRMLS_CC); \
|
zend_hash_apply(EX(symbol_table), zend_check_symbol TSRMLS_CC); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int zend_check_symbol(zval *pz TSRMLS_DC)
|
static int zend_check_symbol(zval *pz TSRMLS_DC)
|
||||||
|
@ -1543,6 +1543,93 @@ void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /*
|
||||||
* +----------------------------------------+
|
* +----------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static zend_always_inline void i_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
|
||||||
|
{
|
||||||
|
zend_uint first_extra_arg;
|
||||||
|
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
|
||||||
|
ZEND_ASSERT(EX(object) == Z_OBJ(EG(This)));
|
||||||
|
|
||||||
|
EX(return_value) = return_value;
|
||||||
|
EX(frame_kind) = frame_kind;
|
||||||
|
ZVAL_UNDEF(&EX(old_error_reporting));
|
||||||
|
EX(delayed_exception) = NULL;
|
||||||
|
EX(call) = NULL;
|
||||||
|
|
||||||
|
EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
|
||||||
|
EX(scope) = EG(scope);
|
||||||
|
|
||||||
|
first_extra_arg = op_array->num_args;
|
||||||
|
|
||||||
|
if (UNEXPECTED((op_array->fn_flags & ZEND_ACC_VARIADIC) != 0)) {
|
||||||
|
first_extra_arg--;
|
||||||
|
}
|
||||||
|
if (UNEXPECTED(EX(num_args) > first_extra_arg)) {
|
||||||
|
/* move extra args into separate array after all CV and TMP vars */
|
||||||
|
zval *extra_args = EX_VAR_NUM(op_array->last_var + op_array->T);
|
||||||
|
|
||||||
|
memmove(extra_args, EX_VAR_NUM(first_extra_arg), sizeof(zval) * (EX(num_args) - first_extra_arg));
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
/* Initialize CV variables (skip arguments) */
|
||||||
|
int num_args = MIN(op_array->num_args, EX(num_args));
|
||||||
|
|
||||||
|
if (EXPECTED(num_args < op_array->last_var)) {
|
||||||
|
zval *var = EX_VAR_NUM(num_args);
|
||||||
|
zval *end = EX_VAR_NUM(op_array->last_var);
|
||||||
|
|
||||||
|
do {
|
||||||
|
ZVAL_UNDEF(var);
|
||||||
|
var++;
|
||||||
|
} while (var != end);
|
||||||
|
}
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
if (op_array->this_var != -1 && Z_OBJ(EG(This))) {
|
||||||
|
ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EG(This)));
|
||||||
|
Z_ADDREF(EG(This));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!op_array->run_time_cache && op_array->last_cache_slot) {
|
||||||
|
if (op_array->function_name) {
|
||||||
|
op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*));
|
||||||
|
} else {
|
||||||
|
op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EX(run_time_cache) = op_array->run_time_cache;
|
||||||
|
|
||||||
|
EG(current_execute_data) = execute_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static zend_always_inline void i_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
|
||||||
|
{
|
||||||
|
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
|
||||||
|
ZEND_ASSERT(EX(object) == Z_OBJ(EG(This)));
|
||||||
|
|
||||||
|
EX(return_value) = return_value;
|
||||||
|
EX(frame_kind) = frame_kind;
|
||||||
|
ZVAL_UNDEF(&EX(old_error_reporting));
|
||||||
|
EX(delayed_exception) = NULL;
|
||||||
|
EX(call) = NULL;
|
||||||
|
|
||||||
|
EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
|
||||||
|
EX(scope) = EG(scope);
|
||||||
|
|
||||||
|
zend_attach_symbol_table(execute_data);
|
||||||
|
|
||||||
|
if (!op_array->run_time_cache && op_array->last_cache_slot) {
|
||||||
|
if (op_array->function_name) {
|
||||||
|
op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*));
|
||||||
|
} else {
|
||||||
|
op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EX(run_time_cache) = op_array->run_time_cache;
|
||||||
|
|
||||||
|
EG(current_execute_data) = execute_data;
|
||||||
|
}
|
||||||
|
|
||||||
static zend_always_inline void i_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
|
static zend_always_inline void i_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
|
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
|
||||||
|
@ -1556,7 +1643,6 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da
|
||||||
|
|
||||||
EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
|
EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
|
||||||
EX(scope) = EG(scope);
|
EX(scope) = EG(scope);
|
||||||
EX(symbol_table) = EG(active_symbol_table);
|
|
||||||
|
|
||||||
if (UNEXPECTED(EX(symbol_table) != NULL)) {
|
if (UNEXPECTED(EX(symbol_table) != NULL)) {
|
||||||
zend_attach_symbol_table(execute_data);
|
zend_attach_symbol_table(execute_data);
|
||||||
|
|
|
@ -159,7 +159,7 @@ void init_executor(TSRMLS_D) /* {{{ */
|
||||||
zend_hash_init(&EG(symbol_table).ht, 64, NULL, ZVAL_PTR_DTOR, 0);
|
zend_hash_init(&EG(symbol_table).ht, 64, NULL, ZVAL_PTR_DTOR, 0);
|
||||||
GC_REFCOUNT(&EG(symbol_table)) = 1;
|
GC_REFCOUNT(&EG(symbol_table)) = 1;
|
||||||
GC_TYPE_INFO(&EG(symbol_table)) = IS_ARRAY;
|
GC_TYPE_INFO(&EG(symbol_table)) = IS_ARRAY;
|
||||||
EG(active_symbol_table) = &EG(symbol_table);
|
EG(valid_symbol_table) = 1;
|
||||||
|
|
||||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
|
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -266,6 +266,7 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
|
||||||
}
|
}
|
||||||
zend_hash_graceful_reverse_destroy(&EG(symbol_table).ht);
|
zend_hash_graceful_reverse_destroy(&EG(symbol_table).ht);
|
||||||
} zend_end_try();
|
} zend_end_try();
|
||||||
|
EG(valid_symbol_table) = 0;
|
||||||
|
|
||||||
zend_try {
|
zend_try {
|
||||||
zval *zeh;
|
zval *zeh;
|
||||||
|
@ -659,7 +660,6 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
|
||||||
int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) /* {{{ */
|
int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zend_uint i;
|
zend_uint i;
|
||||||
zend_array *calling_symbol_table;
|
|
||||||
zend_class_entry *calling_scope = NULL;
|
zend_class_entry *calling_scope = NULL;
|
||||||
zend_execute_data *call, dummy_execute_data;
|
zend_execute_data *call, dummy_execute_data;
|
||||||
zend_fcall_info_cache fci_cache_local;
|
zend_fcall_info_cache fci_cache_local;
|
||||||
|
@ -847,24 +847,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||||
EG(current_execute_data)->call = call;
|
EG(current_execute_data)->call = call;
|
||||||
|
|
||||||
if (func->type == ZEND_USER_FUNCTION) {
|
if (func->type == ZEND_USER_FUNCTION) {
|
||||||
calling_symbol_table = EG(active_symbol_table);
|
|
||||||
EG(scope) = func->common.scope;
|
EG(scope) = func->common.scope;
|
||||||
if (fci->symbol_table) {
|
call->symbol_table = fci->symbol_table;
|
||||||
EG(active_symbol_table) = fci->symbol_table;
|
|
||||||
} else {
|
|
||||||
EG(active_symbol_table) = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EXPECTED((func->op_array.fn_flags & ZEND_ACC_GENERATOR) == 0)) {
|
if (EXPECTED((func->op_array.fn_flags & ZEND_ACC_GENERATOR) == 0)) {
|
||||||
zend_execute(&func->op_array, fci->retval TSRMLS_CC);
|
zend_execute(&func->op_array, fci->retval TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
zend_generator_create_zval(&func->op_array, fci->retval TSRMLS_CC);
|
zend_generator_create_zval(&func->op_array, fci->retval TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fci->symbol_table && EG(active_symbol_table)) {
|
|
||||||
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
|
|
||||||
}
|
|
||||||
EG(active_symbol_table) = calling_symbol_table;
|
|
||||||
} else if (func->type == ZEND_INTERNAL_FUNCTION) {
|
} else if (func->type == ZEND_INTERNAL_FUNCTION) {
|
||||||
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
|
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
|
||||||
ZVAL_NULL(fci->retval);
|
ZVAL_NULL(fci->retval);
|
||||||
|
@ -1105,9 +1094,6 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
|
||||||
int orig_interactive = CG(interactive);
|
int orig_interactive = CG(interactive);
|
||||||
|
|
||||||
EG(no_extensions)=1;
|
EG(no_extensions)=1;
|
||||||
if (!EG(active_symbol_table)) {
|
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
CG(interactive) = 0;
|
CG(interactive) = 0;
|
||||||
|
|
||||||
zend_try {
|
zend_try {
|
||||||
|
@ -1115,6 +1101,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
|
||||||
if (EG(current_execute_data)) {
|
if (EG(current_execute_data)) {
|
||||||
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
|
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
|
||||||
|
EG(current_execute_data)->call->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
zend_execute(new_op_array, &local_retval TSRMLS_CC);
|
zend_execute(new_op_array, &local_retval TSRMLS_CC);
|
||||||
} zend_catch {
|
} zend_catch {
|
||||||
|
@ -1607,12 +1594,11 @@ ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC) /* {{{ */
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
|
ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
|
||||||
{
|
{
|
||||||
zend_uint i;
|
zend_uint i;
|
||||||
zend_execute_data *ex;
|
zend_execute_data *ex;
|
||||||
|
zend_array *symbol_table;
|
||||||
if (!EG(active_symbol_table)) {
|
|
||||||
|
|
||||||
/* Search for last called user function */
|
/* Search for last called user function */
|
||||||
ex = EG(current_execute_data);
|
ex = EG(current_execute_data);
|
||||||
|
@ -1620,32 +1606,30 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
|
||||||
ex = ex->prev_execute_data;
|
ex = ex->prev_execute_data;
|
||||||
}
|
}
|
||||||
if (!ex) {
|
if (!ex) {
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (ex->symbol_table) {
|
if (ex->symbol_table) {
|
||||||
EG(active_symbol_table) = ex->symbol_table;
|
return ex->symbol_table;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
|
if (EG(symtable_cache_ptr) >= EG(symtable_cache)) {
|
||||||
/*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
|
/*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
|
||||||
EG(active_symbol_table) = *(EG(symtable_cache_ptr)--);
|
symbol_table = ex->symbol_table = *(EG(symtable_cache_ptr)--);
|
||||||
} else {
|
} else {
|
||||||
EG(active_symbol_table) = emalloc(sizeof(zend_array));
|
symbol_table = ex->symbol_table = emalloc(sizeof(zend_array));
|
||||||
GC_REFCOUNT(EG(active_symbol_table)) = 0;
|
GC_REFCOUNT(symbol_table) = 0;
|
||||||
GC_TYPE_INFO(EG(active_symbol_table)) = IS_ARRAY;
|
GC_TYPE_INFO(symbol_table) = IS_ARRAY;
|
||||||
zend_hash_init(&EG(active_symbol_table)->ht, ex->func->op_array.last_var, NULL, ZVAL_PTR_DTOR, 0);
|
zend_hash_init(&symbol_table->ht, ex->func->op_array.last_var, NULL, ZVAL_PTR_DTOR, 0);
|
||||||
/*printf("Cache miss! Initialized %x\n", EG(active_symbol_table));*/
|
/*printf("Cache miss! Initialized %x\n", EG(active_symbol_table));*/
|
||||||
}
|
}
|
||||||
ex->symbol_table = EG(active_symbol_table);
|
|
||||||
for (i = 0; i < ex->func->op_array.last_var; i++) {
|
for (i = 0; i < ex->func->op_array.last_var; i++) {
|
||||||
zval zv;
|
zval zv;
|
||||||
|
|
||||||
ZVAL_INDIRECT(&zv, EX_VAR_NUM_2(ex, i));
|
ZVAL_INDIRECT(&zv, EX_VAR_NUM_2(ex, i));
|
||||||
zend_hash_add_new(&EG(active_symbol_table)->ht,
|
zend_hash_add_new(&symbol_table->ht,
|
||||||
ex->func->op_array.vars[i], &zv);
|
ex->func->op_array.vars[i], &zv);
|
||||||
}
|
}
|
||||||
}
|
return symbol_table;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -1700,18 +1684,18 @@ ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data) /* {{{ *
|
||||||
|
|
||||||
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC) /* {{{ */
|
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
if (!EG(active_symbol_table)) {
|
|
||||||
int i;
|
|
||||||
zend_execute_data *execute_data = EG(current_execute_data);
|
zend_execute_data *execute_data = EG(current_execute_data);
|
||||||
zend_op_array *op_array;
|
|
||||||
zend_ulong h = STR_HASH_VAL(name);
|
|
||||||
|
|
||||||
while (execute_data && (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type))) {
|
while (execute_data && (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type))) {
|
||||||
execute_data = execute_data->prev_execute_data;
|
execute_data = execute_data->prev_execute_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (execute_data && execute_data->func) {
|
if (execute_data) {
|
||||||
op_array = &execute_data->func->op_array;
|
if (!execute_data->symbol_table) {
|
||||||
|
zend_ulong h = STR_HASH_VAL(name);
|
||||||
|
zend_op_array *op_array = &execute_data->func->op_array;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < op_array->last_var; i++) {
|
for (i = 0; i < op_array->last_var; i++) {
|
||||||
if (op_array->vars[i]->h == h &&
|
if (op_array->vars[i]->h == h &&
|
||||||
op_array->vars[i]->len == name->len &&
|
op_array->vars[i]->len == name->len &&
|
||||||
|
@ -1720,36 +1704,34 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (force) {
|
if (force) {
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
if (EG(active_symbol_table)) {
|
if (symbol_table) {
|
||||||
zend_hash_update(&EG(active_symbol_table)->ht, name, value);
|
return zend_hash_update(&symbol_table->ht, name, value) ? SUCCESS : FAILURE;;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
return (zend_hash_update_ind(&execute_data->symbol_table->ht, name, value) != NULL) ? SUCCESS : FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return (zend_hash_update_ind(&EG(active_symbol_table)->ht, name, value) != NULL) ? SUCCESS : FAILURE;
|
|
||||||
}
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC) /* {{{ */
|
ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
if (!EG(active_symbol_table)) {
|
|
||||||
int i;
|
|
||||||
zend_execute_data *execute_data = EG(current_execute_data);
|
zend_execute_data *execute_data = EG(current_execute_data);
|
||||||
zend_op_array *op_array;
|
|
||||||
zend_ulong h = zend_hash_func(name, len);
|
|
||||||
|
|
||||||
while (execute_data && (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type))) {
|
while (execute_data && (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type))) {
|
||||||
execute_data = execute_data->prev_execute_data;
|
execute_data = execute_data->prev_execute_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (execute_data && execute_data->func) {
|
if (execute_data) {
|
||||||
op_array = &execute_data->func->op_array;
|
if (!execute_data->symbol_table) {
|
||||||
|
zend_ulong h = zend_hash_func(name, len);
|
||||||
|
zend_op_array *op_array = &execute_data->func->op_array;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < op_array->last_var; i++) {
|
for (i = 0; i < op_array->last_var; i++) {
|
||||||
if (op_array->vars[i]->h == h &&
|
if (op_array->vars[i]->h == h &&
|
||||||
op_array->vars[i]->len == len &&
|
op_array->vars[i]->len == len &&
|
||||||
|
@ -1758,19 +1740,18 @@ ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (force) {
|
if (force) {
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
if (EG(active_symbol_table)) {
|
if (symbol_table) {
|
||||||
zend_hash_str_update(&EG(active_symbol_table)->ht, name, len, value);
|
return zend_hash_str_update(&symbol_table->ht, name, len, value) ? SUCCESS : FAILURE;;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
return (zend_hash_str_update_ind(&execute_data->symbol_table->ht, name, len, value) != NULL) ? SUCCESS : FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return (zend_hash_str_update_ind(&EG(active_symbol_table)->ht, name, len, value) != NULL) ? SUCCESS : FAILURE;
|
|
||||||
}
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
|
@ -224,13 +224,11 @@ static int copy_closure_static_var(zval *var TSRMLS_DC, int num_args, va_list ar
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* Requires globals EG(scope), EG(current_scope), EG(This),
|
/* Requires globals EG(scope), EG(This) and EG(current_execute_data). */
|
||||||
* EG(active_symbol_table) and EG(current_execute_data). */
|
|
||||||
ZEND_API void zend_generator_create_zval(zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
|
ZEND_API void zend_generator_create_zval(zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zend_generator *generator;
|
zend_generator *generator;
|
||||||
zend_execute_data *current_execute_data;
|
zend_execute_data *current_execute_data;
|
||||||
zend_array *current_symbol_table;
|
|
||||||
zend_execute_data *execute_data;
|
zend_execute_data *execute_data;
|
||||||
zend_vm_stack current_stack = EG(argument_stack);
|
zend_vm_stack current_stack = EG(argument_stack);
|
||||||
|
|
||||||
|
@ -259,13 +257,9 @@ ZEND_API void zend_generator_create_zval(zend_op_array *op_array, zval *return_v
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create new execution context. We have to back up and restore
|
/* Create new execution context. We have to back up and restore
|
||||||
* EG(current_execute_data) and EG(active_symbol_table)
|
* EG(current_execute_data) here. */
|
||||||
* here because the function modifies or uses them */
|
|
||||||
current_execute_data = EG(current_execute_data);
|
current_execute_data = EG(current_execute_data);
|
||||||
current_symbol_table = EG(active_symbol_table);
|
|
||||||
EG(active_symbol_table) = NULL;
|
|
||||||
execute_data = zend_create_generator_execute_data(op_array, return_value TSRMLS_CC);
|
execute_data = zend_create_generator_execute_data(op_array, return_value TSRMLS_CC);
|
||||||
EG(active_symbol_table) = current_symbol_table;
|
|
||||||
EG(current_execute_data) = current_execute_data;
|
EG(current_execute_data) = current_execute_data;
|
||||||
|
|
||||||
object_init_ex(return_value, zend_ce_generator);
|
object_init_ex(return_value, zend_ce_generator);
|
||||||
|
@ -311,7 +305,6 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
|
||||||
{
|
{
|
||||||
/* Backup executor globals */
|
/* Backup executor globals */
|
||||||
zend_execute_data *original_execute_data = EG(current_execute_data);
|
zend_execute_data *original_execute_data = EG(current_execute_data);
|
||||||
zend_array *original_active_symbol_table = EG(active_symbol_table);
|
|
||||||
zend_object *original_This;
|
zend_object *original_This;
|
||||||
zend_class_entry *original_scope = EG(scope);
|
zend_class_entry *original_scope = EG(scope);
|
||||||
zend_vm_stack original_stack = EG(argument_stack);
|
zend_vm_stack original_stack = EG(argument_stack);
|
||||||
|
@ -320,7 +313,6 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
|
||||||
|
|
||||||
/* Set executor globals */
|
/* Set executor globals */
|
||||||
EG(current_execute_data) = generator->execute_data;
|
EG(current_execute_data) = generator->execute_data;
|
||||||
EG(active_symbol_table) = generator->execute_data->symbol_table;
|
|
||||||
Z_OBJ(EG(This)) = generator->execute_data->object;
|
Z_OBJ(EG(This)) = generator->execute_data->object;
|
||||||
EG(scope) = generator->execute_data->scope;
|
EG(scope) = generator->execute_data->scope;
|
||||||
EG(argument_stack) = generator->stack;
|
EG(argument_stack) = generator->stack;
|
||||||
|
@ -348,7 +340,6 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
|
||||||
|
|
||||||
/* Restore executor globals */
|
/* Restore executor globals */
|
||||||
EG(current_execute_data) = original_execute_data;
|
EG(current_execute_data) = original_execute_data;
|
||||||
EG(active_symbol_table) = original_active_symbol_table;
|
|
||||||
Z_OBJ(EG(This)) = original_This;
|
Z_OBJ(EG(This)) = original_This;
|
||||||
EG(scope) = original_scope;
|
EG(scope) = original_scope;
|
||||||
EG(argument_stack) = original_stack;
|
EG(argument_stack) = original_stack;
|
||||||
|
|
|
@ -170,7 +170,6 @@ struct _zend_executor_globals {
|
||||||
zend_array **symtable_cache_limit;
|
zend_array **symtable_cache_limit;
|
||||||
zend_array **symtable_cache_ptr;
|
zend_array **symtable_cache_ptr;
|
||||||
|
|
||||||
zend_array *active_symbol_table;
|
|
||||||
zend_array symbol_table; /* main symbol table */
|
zend_array symbol_table; /* main symbol table */
|
||||||
|
|
||||||
HashTable included_files; /* files already included */
|
HashTable included_files; /* files already included */
|
||||||
|
@ -241,6 +240,7 @@ struct _zend_executor_globals {
|
||||||
zend_property_info std_property_info;
|
zend_property_info std_property_info;
|
||||||
|
|
||||||
zend_bool active;
|
zend_bool active;
|
||||||
|
zend_bool valid_symbol_table;
|
||||||
|
|
||||||
zend_op *start_op;
|
zend_op *start_op;
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,7 @@ ZEND_API void _zval_internal_ptr_dtor_wrapper(zval *zval_ptr)
|
||||||
|
|
||||||
ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
|
ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
|
||||||
{
|
{
|
||||||
|
zend_array *symbol_table;
|
||||||
HashTable *target = va_arg(args, HashTable*);
|
HashTable *target = va_arg(args, HashTable*);
|
||||||
zend_bool is_ref;
|
zend_bool is_ref;
|
||||||
zval tmp;
|
zval tmp;
|
||||||
|
@ -312,16 +313,14 @@ ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args,
|
||||||
if (Z_CONST_FLAGS_P(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) {
|
if (Z_CONST_FLAGS_P(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) {
|
||||||
is_ref = Z_CONST_FLAGS_P(p) & IS_LEXICAL_REF;
|
is_ref = Z_CONST_FLAGS_P(p) & IS_LEXICAL_REF;
|
||||||
|
|
||||||
if (!EG(active_symbol_table)) {
|
symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
p = zend_hash_find(&symbol_table->ht, key->key);
|
||||||
}
|
|
||||||
p = zend_hash_find(&EG(active_symbol_table)->ht, key->key);
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
p = &tmp;
|
p = &tmp;
|
||||||
ZVAL_NULL(&tmp);
|
ZVAL_NULL(&tmp);
|
||||||
if (is_ref) {
|
if (is_ref) {
|
||||||
ZVAL_NEW_REF(&tmp, &tmp);
|
ZVAL_NEW_REF(&tmp, &tmp);
|
||||||
zend_hash_add_new(&EG(active_symbol_table)->ht, key->key, &tmp);
|
zend_hash_add_new(&symbol_table->ht, key->key, &tmp);
|
||||||
Z_ADDREF_P(p);
|
Z_ADDREF_P(p);
|
||||||
} else {
|
} else {
|
||||||
zend_error(E_NOTICE,"Undefined variable: %s", key->key->val);
|
zend_error(E_NOTICE,"Undefined variable: %s", key->key->val);
|
||||||
|
|
|
@ -1789,7 +1789,6 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
||||||
|
|
||||||
execute_data = EG(current_execute_data);
|
execute_data = EG(current_execute_data);
|
||||||
EX(call) = prev_nested_call;
|
EX(call) = prev_nested_call;
|
||||||
EG(active_symbol_table) = EX(symbol_table);
|
|
||||||
|
|
||||||
if (Z_OBJ(EG(This))) {
|
if (Z_OBJ(EG(This))) {
|
||||||
if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
|
if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
|
||||||
|
@ -1843,6 +1842,9 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
||||||
} else {
|
} else {
|
||||||
if (frame_kind == VM_FRAME_TOP_FUNCTION) {
|
if (frame_kind == VM_FRAME_TOP_FUNCTION) {
|
||||||
i_free_compiled_variables(execute_data TSRMLS_CC);
|
i_free_compiled_variables(execute_data TSRMLS_CC);
|
||||||
|
if (UNEXPECTED(EX(symbol_table) != NULL)) {
|
||||||
|
zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
|
||||||
|
}
|
||||||
zend_vm_stack_free_extra_args(execute_data TSRMLS_CC);
|
zend_vm_stack_free_extra_args(execute_data TSRMLS_CC);
|
||||||
} else /* if (frame_kind == VM_FRAME_TOP_CODE) */ {
|
} else /* if (frame_kind == VM_FRAME_TOP_CODE) */ {
|
||||||
zend_array *symbol_table = EX(symbol_table);
|
zend_array *symbol_table = EX(symbol_table);
|
||||||
|
@ -2681,7 +2683,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
|
||||||
|
|
||||||
Z_OBJ(EG(This)) = call->object;
|
Z_OBJ(EG(This)) = call->object;
|
||||||
EG(scope) = fbc->common.scope;
|
EG(scope) = fbc->common.scope;
|
||||||
EG(active_symbol_table) = NULL;
|
call->symbol_table = NULL;
|
||||||
if (RETURN_VALUE_USED(opline)) {
|
if (RETURN_VALUE_USED(opline)) {
|
||||||
return_value = EX_VAR(opline->result.var);
|
return_value = EX_VAR(opline->result.var);
|
||||||
|
|
||||||
|
@ -2698,7 +2700,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
|
||||||
zend_vm_stack_free_call_frame(call TSRMLS_CC);
|
zend_vm_stack_free_call_frame(call TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
call->prev_execute_data = execute_data;
|
call->prev_execute_data = execute_data;
|
||||||
i_init_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC);
|
i_init_func_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC);
|
||||||
|
|
||||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||||
ZEND_VM_ENTER();
|
ZEND_VM_ENTER();
|
||||||
|
@ -2706,11 +2708,6 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
|
||||||
execute_ex(call TSRMLS_CC);
|
execute_ex(call TSRMLS_CC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNEXPECTED(EG(active_symbol_table) != NULL)) {
|
|
||||||
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
|
|
||||||
}
|
|
||||||
EG(active_symbol_table) = EX(symbol_table);
|
|
||||||
} else { /* ZEND_OVERLOADED_FUNCTION */
|
} else { /* ZEND_OVERLOADED_FUNCTION */
|
||||||
Z_OBJ(EG(This)) = call->object;
|
Z_OBJ(EG(This)) = call->object;
|
||||||
//??? EG(scope) = NULL;
|
//??? EG(scope) = NULL;
|
||||||
|
@ -3985,12 +3982,14 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
|
||||||
EX(call) = zend_vm_stack_push_call_frame(
|
EX(call) = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
||||||
|
|
||||||
if (!EX(symbol_table)) {
|
if (EX(symbol_table)) {
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
EX(call)->symbol_table = EX(symbol_table);
|
||||||
|
} else {
|
||||||
|
EX(call)->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX(call)->prev_execute_data = execute_data;
|
EX(call)->prev_execute_data = execute_data;
|
||||||
i_init_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
i_init_code_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
||||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||||
ZEND_VM_ENTER();
|
ZEND_VM_ENTER();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -381,9 +381,10 @@ ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC
|
||||||
} else {
|
} else {
|
||||||
execute_data = zend_vm_stack_push_call_frame(
|
execute_data = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
|
(zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
|
||||||
|
execute_data->symbol_table = &EG(symbol_table);
|
||||||
}
|
}
|
||||||
EX(prev_execute_data) = EG(current_execute_data);
|
EX(prev_execute_data) = EG(current_execute_data);
|
||||||
i_init_execute_data(execute_data, op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
|
i_init_execute_data(execute_data, op_array, return_value, (execute_data->symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
|
||||||
zend_execute_ex(execute_data TSRMLS_CC);
|
zend_execute_ex(execute_data TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +408,6 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||||
|
|
||||||
execute_data = EG(current_execute_data);
|
execute_data = EG(current_execute_data);
|
||||||
EX(call) = prev_nested_call;
|
EX(call) = prev_nested_call;
|
||||||
EG(active_symbol_table) = EX(symbol_table);
|
|
||||||
|
|
||||||
if (Z_OBJ(EG(This))) {
|
if (Z_OBJ(EG(This))) {
|
||||||
if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
|
if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
|
||||||
|
@ -461,6 +461,9 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||||
} else {
|
} else {
|
||||||
if (frame_kind == VM_FRAME_TOP_FUNCTION) {
|
if (frame_kind == VM_FRAME_TOP_FUNCTION) {
|
||||||
i_free_compiled_variables(execute_data TSRMLS_CC);
|
i_free_compiled_variables(execute_data TSRMLS_CC);
|
||||||
|
if (UNEXPECTED(EX(symbol_table) != NULL)) {
|
||||||
|
zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
|
||||||
|
}
|
||||||
zend_vm_stack_free_extra_args(execute_data TSRMLS_CC);
|
zend_vm_stack_free_extra_args(execute_data TSRMLS_CC);
|
||||||
} else /* if (frame_kind == VM_FRAME_TOP_CODE) */ {
|
} else /* if (frame_kind == VM_FRAME_TOP_CODE) */ {
|
||||||
zend_array *symbol_table = EX(symbol_table);
|
zend_array *symbol_table = EX(symbol_table);
|
||||||
|
@ -628,7 +631,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||||
|
|
||||||
Z_OBJ(EG(This)) = call->object;
|
Z_OBJ(EG(This)) = call->object;
|
||||||
EG(scope) = fbc->common.scope;
|
EG(scope) = fbc->common.scope;
|
||||||
EG(active_symbol_table) = NULL;
|
call->symbol_table = NULL;
|
||||||
if (RETURN_VALUE_USED(opline)) {
|
if (RETURN_VALUE_USED(opline)) {
|
||||||
return_value = EX_VAR(opline->result.var);
|
return_value = EX_VAR(opline->result.var);
|
||||||
|
|
||||||
|
@ -645,7 +648,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||||
zend_vm_stack_free_call_frame(call TSRMLS_CC);
|
zend_vm_stack_free_call_frame(call TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
call->prev_execute_data = execute_data;
|
call->prev_execute_data = execute_data;
|
||||||
i_init_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC);
|
i_init_func_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC);
|
||||||
|
|
||||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||||
ZEND_VM_ENTER();
|
ZEND_VM_ENTER();
|
||||||
|
@ -653,11 +656,6 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||||
execute_ex(call TSRMLS_CC);
|
execute_ex(call TSRMLS_CC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNEXPECTED(EG(active_symbol_table) != NULL)) {
|
|
||||||
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
|
|
||||||
}
|
|
||||||
EG(active_symbol_table) = EX(symbol_table);
|
|
||||||
} else { /* ZEND_OVERLOADED_FUNCTION */
|
} else { /* ZEND_OVERLOADED_FUNCTION */
|
||||||
Z_OBJ(EG(This)) = call->object;
|
Z_OBJ(EG(This)) = call->object;
|
||||||
//??? EG(scope) = NULL;
|
//??? EG(scope) = NULL;
|
||||||
|
@ -2920,12 +2918,14 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
|
||||||
EX(call) = zend_vm_stack_push_call_frame(
|
EX(call) = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
||||||
|
|
||||||
if (!EX(symbol_table)) {
|
if (EX(symbol_table)) {
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
EX(call)->symbol_table = EX(symbol_table);
|
||||||
|
} else {
|
||||||
|
EX(call)->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX(call)->prev_execute_data = execute_data;
|
EX(call)->prev_execute_data = execute_data;
|
||||||
i_init_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
i_init_code_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
||||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||||
ZEND_VM_ENTER();
|
ZEND_VM_ENTER();
|
||||||
} else {
|
} else {
|
||||||
|
@ -8111,12 +8111,14 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
|
||||||
EX(call) = zend_vm_stack_push_call_frame(
|
EX(call) = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
||||||
|
|
||||||
if (!EX(symbol_table)) {
|
if (EX(symbol_table)) {
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
EX(call)->symbol_table = EX(symbol_table);
|
||||||
|
} else {
|
||||||
|
EX(call)->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX(call)->prev_execute_data = execute_data;
|
EX(call)->prev_execute_data = execute_data;
|
||||||
i_init_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
i_init_code_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
||||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||||
ZEND_VM_ENTER();
|
ZEND_VM_ENTER();
|
||||||
} else {
|
} else {
|
||||||
|
@ -13369,12 +13371,14 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
|
||||||
EX(call) = zend_vm_stack_push_call_frame(
|
EX(call) = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
||||||
|
|
||||||
if (!EX(symbol_table)) {
|
if (EX(symbol_table)) {
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
EX(call)->symbol_table = EX(symbol_table);
|
||||||
|
} else {
|
||||||
|
EX(call)->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX(call)->prev_execute_data = execute_data;
|
EX(call)->prev_execute_data = execute_data;
|
||||||
i_init_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
i_init_code_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
||||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||||
ZEND_VM_ENTER();
|
ZEND_VM_ENTER();
|
||||||
} else {
|
} else {
|
||||||
|
@ -30499,12 +30503,14 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
|
||||||
EX(call) = zend_vm_stack_push_call_frame(
|
EX(call) = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
|
||||||
|
|
||||||
if (!EX(symbol_table)) {
|
if (EX(symbol_table)) {
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
EX(call)->symbol_table = EX(symbol_table);
|
||||||
|
} else {
|
||||||
|
EX(call)->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX(call)->prev_execute_data = execute_data;
|
EX(call)->prev_execute_data = execute_data;
|
||||||
i_init_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
i_init_code_execute_data(EX(call), new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
|
||||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||||
ZEND_VM_ENTER();
|
ZEND_VM_ENTER();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,9 +40,10 @@ ZEND_API void zend_{%EXECUTOR_NAME%}(zend_op_array *op_array, zval *return_value
|
||||||
} else {
|
} else {
|
||||||
execute_data = zend_vm_stack_push_call_frame(
|
execute_data = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
|
(zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
|
||||||
|
execute_data->symbol_table = &EG(symbol_table);
|
||||||
}
|
}
|
||||||
EX(prev_execute_data) = EG(current_execute_data);
|
EX(prev_execute_data) = EG(current_execute_data);
|
||||||
i_init_execute_data(execute_data, op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
|
i_init_execute_data(execute_data, op_array, return_value, (execute_data->symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
|
||||||
zend_{%EXECUTOR_NAME%}_ex(execute_data TSRMLS_CC);
|
zend_{%EXECUTOR_NAME%}_ex(execute_data TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2084,10 +2084,9 @@ PHP_FUNCTION(mb_parse_str)
|
||||||
detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr TSRMLS_CC);
|
detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
zval tmp;
|
zval tmp;
|
||||||
if (!EG(active_symbol_table)) {
|
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
ZVAL_ARR(&tmp, symbol_table);
|
||||||
ZVAL_ARR(&tmp, EG(active_symbol_table));
|
|
||||||
detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr TSRMLS_CC);
|
detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
|
||||||
if (EG(current_execute_data)) {
|
if (EG(current_execute_data)) {
|
||||||
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
|
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
|
||||||
|
EG(current_execute_data)->call->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
zend_execute(new_op_array, &result TSRMLS_CC);
|
zend_execute(new_op_array, &result TSRMLS_CC);
|
||||||
if (PHAR_G(cwd)) {
|
if (PHAR_G(cwd)) {
|
||||||
|
|
|
@ -432,8 +432,9 @@ static char *cli_completion_generator_ht(const char *text, int textlen, int *sta
|
||||||
static char *cli_completion_generator_var(const char *text, int textlen, int *state TSRMLS_DC) /* {{{ */
|
static char *cli_completion_generator_var(const char *text, int textlen, int *state TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
char *retval, *tmp;
|
char *retval, *tmp;
|
||||||
|
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
|
|
||||||
tmp = retval = cli_completion_generator_ht(text + 1, textlen - 1, state, EG(active_symbol_table) ? &EG(active_symbol_table)->ht : NULL, NULL TSRMLS_CC);
|
tmp = retval = cli_completion_generator_ht(text + 1, textlen - 1, state, symbol_table ? &symbol_table->ht : NULL, NULL TSRMLS_CC);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
retval = malloc(strlen(tmp) + 2);
|
retval = malloc(strlen(tmp) + 2);
|
||||||
retval[0] = '$';
|
retval[0] = '$';
|
||||||
|
|
|
@ -286,14 +286,11 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
|
||||||
}
|
}
|
||||||
STR_RELEASE(opened_path);
|
STR_RELEASE(opened_path);
|
||||||
if (new_op_array) {
|
if (new_op_array) {
|
||||||
if (!EG(active_symbol_table)) {
|
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZVAL_UNDEF(&result);
|
ZVAL_UNDEF(&result);
|
||||||
if (EG(current_execute_data)) {
|
if (EG(current_execute_data)) {
|
||||||
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
|
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
|
||||||
(zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
|
(zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
|
||||||
|
EG(current_execute_data)->call->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
}
|
}
|
||||||
zend_execute(new_op_array, &result TSRMLS_CC);
|
zend_execute(new_op_array, &result TSRMLS_CC);
|
||||||
|
|
||||||
|
|
|
@ -1294,6 +1294,7 @@ PHP_FUNCTION(extract)
|
||||||
ulong num_key;
|
ulong num_key;
|
||||||
int var_exists, count = 0;
|
int var_exists, count = 0;
|
||||||
int extract_refs = 0;
|
int extract_refs = 0;
|
||||||
|
zend_array *symbol_table;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|lz/", &var_array, &extract_type, &prefix) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|lz/", &var_array, &extract_type, &prefix) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
|
@ -1320,9 +1321,7 @@ PHP_FUNCTION(extract)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EG(active_symbol_table)) {
|
symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(var_array), num_key, var_name, entry) {
|
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(var_array), num_key, var_name, entry) {
|
||||||
zval final_name;
|
zval final_name;
|
||||||
|
@ -1331,7 +1330,7 @@ PHP_FUNCTION(extract)
|
||||||
var_exists = 0;
|
var_exists = 0;
|
||||||
|
|
||||||
if (var_name) {
|
if (var_name) {
|
||||||
var_exists = zend_hash_exists_ind(&EG(active_symbol_table)->ht, var_name);
|
var_exists = zend_hash_exists_ind(&symbol_table->ht, var_name);
|
||||||
} else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
|
} else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
|
||||||
zval num;
|
zval num;
|
||||||
|
|
||||||
|
@ -1401,14 +1400,14 @@ PHP_FUNCTION(extract)
|
||||||
ZVAL_MAKE_REF(entry);
|
ZVAL_MAKE_REF(entry);
|
||||||
Z_ADDREF_P(entry);
|
Z_ADDREF_P(entry);
|
||||||
|
|
||||||
if ((orig_var = zend_hash_find(&EG(active_symbol_table)->ht, Z_STR(final_name))) != NULL) {
|
if ((orig_var = zend_hash_find(&symbol_table->ht, Z_STR(final_name))) != NULL) {
|
||||||
if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
|
if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
|
||||||
orig_var = Z_INDIRECT_P(orig_var);
|
orig_var = Z_INDIRECT_P(orig_var);
|
||||||
}
|
}
|
||||||
zval_ptr_dtor(orig_var);
|
zval_ptr_dtor(orig_var);
|
||||||
ZVAL_COPY_VALUE(orig_var, entry);
|
ZVAL_COPY_VALUE(orig_var, entry);
|
||||||
} else {
|
} else {
|
||||||
zend_hash_update(&EG(active_symbol_table)->ht, Z_STR(final_name), entry);
|
zend_hash_update(&symbol_table->ht, Z_STR(final_name), entry);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
|
if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
|
||||||
|
@ -1458,14 +1457,13 @@ PHP_FUNCTION(compact)
|
||||||
{
|
{
|
||||||
zval *args = NULL; /* function arguments array */
|
zval *args = NULL; /* function arguments array */
|
||||||
int num_args, i;
|
int num_args, i;
|
||||||
|
zend_array *symbol_table;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &num_args) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &num_args) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EG(active_symbol_table)) {
|
symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compact() is probably most used with a single array of var_names
|
/* compact() is probably most used with a single array of var_names
|
||||||
or multiple string names, rather than a combination of both.
|
or multiple string names, rather than a combination of both.
|
||||||
|
@ -1477,7 +1475,7 @@ PHP_FUNCTION(compact)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<ZEND_NUM_ARGS(); i++) {
|
for (i=0; i<ZEND_NUM_ARGS(); i++) {
|
||||||
php_compact_var(&EG(active_symbol_table)->ht, return_value, &args[i] TSRMLS_CC);
|
php_compact_var(&symbol_table->ht, return_value, &args[i] TSRMLS_CC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
|
@ -141,6 +141,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
|
||||||
int follow_location = 1;
|
int follow_location = 1;
|
||||||
php_stream_filter *transfer_encoding = NULL;
|
php_stream_filter *transfer_encoding = NULL;
|
||||||
int response_code;
|
int response_code;
|
||||||
|
zend_array *symbol_table;
|
||||||
|
|
||||||
tmp_line[0] = '\0';
|
tmp_line[0] = '\0';
|
||||||
|
|
||||||
|
@ -634,9 +635,7 @@ finish:
|
||||||
|
|
||||||
location[0] = '\0';
|
location[0] = '\0';
|
||||||
|
|
||||||
if (!EG(active_symbol_table)) {
|
symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (header_init) {
|
if (header_init) {
|
||||||
zval ztmp;
|
zval ztmp;
|
||||||
|
@ -644,7 +643,7 @@ finish:
|
||||||
zend_set_local_var_str("http_response_header", sizeof("http_response_header")-1, &ztmp, 0 TSRMLS_CC);
|
zend_set_local_var_str("http_response_header", sizeof("http_response_header")-1, &ztmp, 0 TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
response_header = zend_hash_str_find_ind(&EG(active_symbol_table)->ht, "http_response_header", sizeof("http_response_header")-1);
|
response_header = zend_hash_str_find_ind(&symbol_table->ht, "http_response_header", sizeof("http_response_header")-1);
|
||||||
|
|
||||||
if (!php_stream_eof(stream)) {
|
if (!php_stream_eof(stream)) {
|
||||||
size_t tmp_line_len;
|
size_t tmp_line_len;
|
||||||
|
|
|
@ -4221,11 +4221,9 @@ PHP_FUNCTION(parse_str)
|
||||||
|
|
||||||
if (arrayArg == NULL) {
|
if (arrayArg == NULL) {
|
||||||
zval tmp;
|
zval tmp;
|
||||||
|
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
|
|
||||||
if (!EG(active_symbol_table)) {
|
ZVAL_ARR(&tmp, symbol_table);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
ZVAL_ARR(&tmp, EG(active_symbol_table));
|
|
||||||
sapi_module.treat_data(PARSE_STRING, res, &tmp TSRMLS_CC);
|
sapi_module.treat_data(PARSE_STRING, res, &tmp TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
zval ret;
|
zval ret;
|
||||||
|
|
|
@ -668,10 +668,8 @@ static void php_wddx_add_var(wddx_packet *packet, zval *name_var)
|
||||||
TSRMLS_FETCH();
|
TSRMLS_FETCH();
|
||||||
|
|
||||||
if (Z_TYPE_P(name_var) == IS_STRING) {
|
if (Z_TYPE_P(name_var) == IS_STRING) {
|
||||||
if (!EG(active_symbol_table)) {
|
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
if ((val = zend_hash_find(&symbol_table->ht, Z_STR_P(name_var))) != NULL) {
|
||||||
}
|
|
||||||
if ((val = zend_hash_find(&EG(active_symbol_table)->ht, Z_STR_P(name_var))) != NULL) {
|
|
||||||
if (Z_TYPE_P(val) == IS_INDIRECT) {
|
if (Z_TYPE_P(val) == IS_INDIRECT) {
|
||||||
val = Z_INDIRECT_P(val);
|
val = Z_INDIRECT_P(val);
|
||||||
}
|
}
|
||||||
|
|
17
main/main.c
17
main/main.c
|
@ -897,13 +897,17 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
|
||||||
efree(docref_buf);
|
efree(docref_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PG(track_errors) && module_initialized &&
|
if (PG(track_errors) && module_initialized && EG(valid_symbol_table) &&
|
||||||
(Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) {
|
(Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) {
|
||||||
zval tmp;
|
zval tmp;
|
||||||
ZVAL_STRINGL(&tmp, buffer, buffer_len);
|
ZVAL_STRINGL(&tmp, buffer, buffer_len);
|
||||||
|
if (EG(current_execute_data)) {
|
||||||
if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) {
|
if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) {
|
||||||
zval_ptr_dtor(&tmp);
|
zval_ptr_dtor(&tmp);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
zend_hash_str_update_ind(&EG(symbol_table).ht, "php_errormsg", sizeof("php_errormsg")-1, &tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (replace_buffer) {
|
if (replace_buffer) {
|
||||||
STR_FREE(replace_buffer);
|
STR_FREE(replace_buffer);
|
||||||
|
@ -1227,16 +1231,16 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PG(track_errors) && module_initialized) {
|
if (PG(track_errors) && module_initialized && EG(valid_symbol_table)) {
|
||||||
if (!EG(active_symbol_table)) {
|
|
||||||
zend_rebuild_symbol_table(TSRMLS_C);
|
|
||||||
}
|
|
||||||
if (EG(active_symbol_table)) {
|
|
||||||
zval tmp;
|
zval tmp;
|
||||||
|
|
||||||
ZVAL_STRINGL(&tmp, buffer, buffer_len);
|
ZVAL_STRINGL(&tmp, buffer, buffer_len);
|
||||||
|
if (EG(current_execute_data)) {
|
||||||
if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) {
|
if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) {
|
||||||
zval_ptr_dtor(&tmp);
|
zval_ptr_dtor(&tmp);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
zend_hash_str_update_ind(&EG(symbol_table).ht, "php_errormsg", sizeof("php_errormsg")-1, &tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2125,7 +2129,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
||||||
#endif
|
#endif
|
||||||
EG(bailout) = NULL;
|
EG(bailout) = NULL;
|
||||||
EG(error_reporting) = E_ALL & ~E_NOTICE;
|
EG(error_reporting) = E_ALL & ~E_NOTICE;
|
||||||
EG(active_symbol_table) = NULL;
|
|
||||||
PG(header_is_being_sent) = 0;
|
PG(header_is_being_sent) = 0;
|
||||||
SG(request_info).headers_only = 0;
|
SG(request_info).headers_only = 0;
|
||||||
SG(request_info).argv0 = NULL;
|
SG(request_info).argv0 = NULL;
|
||||||
|
|
|
@ -110,8 +110,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GLOBALS hijack attempt, reject parameter */
|
/* GLOBALS hijack attempt, reject parameter */
|
||||||
if (symtable1 && EG(active_symbol_table) &&
|
if (symtable1 == &EG(symbol_table).ht &&
|
||||||
symtable1 == &EG(active_symbol_table)->ht &&
|
|
||||||
var_len == sizeof("GLOBALS")-1 &&
|
var_len == sizeof("GLOBALS")-1 &&
|
||||||
!memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
|
!memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
|
||||||
zval_dtor(val);
|
zval_dtor(val);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue