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

Fix static assignment

This commit is contained in:
Zeev Suraski
1999-04-08 00:18:29 +00:00
parent d0738c2bc3
commit 135da4b4fc
2 changed files with 6 additions and 1 deletions

View File

@@ -1431,7 +1431,7 @@ void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment
zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
znode lval;
if (fetch_type==ZEND_FETCH_STATIC) {
if (fetch_type==ZEND_FETCH_STATIC && static_assignment) {
zval *tmp = (zval *) emalloc(sizeof(zval));
convert_to_string(&varname->u.constant);
@@ -1459,6 +1459,7 @@ void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment
do_assign_ref(NULL, &lval, &opline->result CLS_CC);
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
}

View File

@@ -379,6 +379,10 @@ static inline void zend_fetch_var_address(znode *result, znode *op1, znode *op2,
target_symbol_table = &EG(symbol_table);
break;
case ZEND_FETCH_STATIC:
if (!EG(active_op_array)->static_variables) {
EG(active_op_array)->static_variables = (HashTable *) emalloc(sizeof(HashTable));
zend_hash_init(EG(active_op_array)->static_variables, 2, NULL, PVAL_PTR_DTOR, 0);
}
target_symbol_table = EG(active_op_array)->static_variables;
break;
}