From dce8267f3556b3108971458b6f04e4bd306d3829 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 19 Jan 2003 17:25:39 +0000 Subject: [PATCH] Restore for now old statics behaviour (so that indirect $$var references would work again). Comprehensive fix will follow later. --- Zend/zend_compile.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0ee2da7e89..86954dd48c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -290,10 +290,10 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar if (zend_hash_exists(CG(auto_globals), varname->u.constant.value.str.val, varname->u.constant.value.str.len+1)) { opline_ptr->op2.u.EA.type = ZEND_FETCH_GLOBAL; } else { - if (CG(active_op_array)->static_variables && zend_hash_exists(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1)) { +/* if (CG(active_op_array)->static_variables && zend_hash_exists(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1)) { opline_ptr->op2.u.EA.type = ZEND_FETCH_STATIC; } - } +*/ } } if (bp) { @@ -2682,6 +2682,9 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC) void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) { zval *tmp; + zend_op *opline; + znode lval; + znode result; ALLOC_ZVAL(tmp); convert_to_string(&varname->u.constant); @@ -2695,7 +2698,26 @@ void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0); } zend_hash_update(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, &tmp, sizeof(zval *), NULL); - zval_dtor(&varname->u.constant); + + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ + opline->result.op_type = IS_VAR; + opline->result.u.EA.type = 0; + opline->result.u.var = get_temporary_variable(CG(active_op_array)); + opline->op1 = *varname; + SET_UNUSED(opline->op2); + opline->op2.u.EA.type = fetch_type; + result = opline->result; + + if (varname->op_type == IS_CONST) { + zval_copy_ctor(&varname->u.constant); + } + fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */ + + zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC); + CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; + +/* zval_dtor(&varname->u.constant); */ } void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) -- 2.40.0