diff options
author | Andi Gutmans <andi@php.net> | 2000-02-14 20:31:01 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-02-14 20:31:01 +0000 |
commit | 7fa17e8e08ca4543a88e9b2467e56eb34c30341c (patch) | |
tree | 43df1f1b5a2611fff21b5dadbe979977393b0231 | |
parent | 95c77887471af4aaa8ecba445b7e69c0e46941e0 (diff) | |
download | php-git-7fa17e8e08ca4543a88e9b2467e56eb34c30341c.tar.gz |
- Put in the infrastructure for the unset() fix. Right now it has the old
behavior but I just need time tomorrow to add the correct behavior.
-rw-r--r-- | Zend/zend-parser.y | 2 | ||||
-rw-r--r-- | Zend/zend_compile.c | 9 | ||||
-rw-r--r-- | Zend/zend_compile.h | 22 | ||||
-rw-r--r-- | Zend/zend_execute.c | 15 |
4 files changed, 35 insertions, 13 deletions
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y index 281f28ae49..0d1d911dac 100644 --- a/Zend/zend-parser.y +++ b/Zend/zend-parser.y @@ -201,7 +201,7 @@ unticked_statement: | expr ';' { do_free(&$1 CLS_CC); } | T_REQUIRE expr ';' { do_require(&$2 CLS_CC); } | T_USE use_filename ';' { use_filename($2.u.constant.value.str.val, $2.u.constant.value.str.len CLS_CC); zval_dtor(&$2.u.constant); } - | T_UNSET '(' r_cvar ')' ';' { do_unset(&$3 CLS_CC); } + | T_UNSET '(' cvar ')' ';' { do_end_variable_parse(BP_VAR_UNSET, 0 CLS_CC); do_unset(&$3 CLS_CC); } | T_FOREACH '(' expr T_AS { do_foreach_begin(&$1, &$3, &$2, &$4 CLS_CC); } w_cvar foreach_optional_arg ')' { do_foreach_cont(&$6, &$7, &$4 CLS_CC); } foreach_statement { do_foreach_end(&$1, &$2 CLS_CC); } | T_DECLARE { do_declare_begin(CLS_C); } '(' declare_list ')' declare_statement { do_declare_end(CLS_C); } | ';' /* empty statement */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 9019850c45..4030c8a679 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -576,6 +576,9 @@ void do_end_variable_parse(int type, int arg_offset CLS_DC) opline->opcode += 9; /* 3+3+3 */ opline->extended_value = arg_offset; break; + case BP_VAR_UNSET: + opline->opcode += 12; /* 3+3+3+3 */ + break; } le = le->next; } @@ -1943,11 +1946,11 @@ void do_unset(znode *variable CLS_DC) last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1]; switch (last_op->opcode) { - case ZEND_FETCH_R: + case ZEND_FETCH_UNSET: last_op->opcode = ZEND_UNSET_VAR; break; - case ZEND_FETCH_DIM_R: - case ZEND_FETCH_OBJ_R: + case ZEND_FETCH_DIM_UNSET: + case ZEND_FETCH_OBJ_UNSET: last_op->opcode = ZEND_UNSET_DIM_OBJ; break; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 45ce3719fc..e7428bf019 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -485,7 +485,7 @@ int zendlex(znode *zendlval CLS_DC); #define ZEND_EXIT 78 -/* the following 15 opcodes are 5 groups of 3 opcodes each, and must +/* the following 18 opcodes are 6 groups of 3 opcodes each, and must * remain in that order! */ #define ZEND_FETCH_R 79 @@ -503,18 +503,21 @@ int zendlex(znode *zendlval CLS_DC); #define ZEND_FETCH_FUNC_ARG 91 #define ZEND_FETCH_DIM_FUNC_ARG 92 #define ZEND_FETCH_OBJ_FUNC_ARG 93 +#define ZEND_FETCH_UNSET 94 +#define ZEND_FETCH_DIM_UNSET 95 +#define ZEND_FETCH_OBJ_UNSET 96 -#define ZEND_FETCH_DIM_TMP_VAR 94 -#define ZEND_FETCH_CONSTANT 95 +#define ZEND_FETCH_DIM_TMP_VAR 97 +#define ZEND_FETCH_CONSTANT 98 -#define ZEND_DECLARE_FUNCTION_OR_CLASS 96 +#define ZEND_DECLARE_FUNCTION_OR_CLASS 99 -#define ZEND_EXT_STMT 97 -#define ZEND_EXT_FCALL_BEGIN 98 -#define ZEND_EXT_FCALL_END 99 -#define ZEND_EXT_NOP 100 +#define ZEND_EXT_STMT 100 +#define ZEND_EXT_FCALL_BEGIN 101 +#define ZEND_EXT_FCALL_END 102 +#define ZEND_EXT_NOP 103 -#define ZEND_TICKS 101 +#define ZEND_TICKS 104 /* end of block */ @@ -533,6 +536,7 @@ int zendlex(znode *zendlval CLS_DC); #define BP_VAR_IS 3 #define BP_VAR_NA 4 /* if not applicable */ #define BP_VAR_FUNC_ARG 5 +#define BP_VAR_UNSET 6 #define ZEND_INTERNAL_FUNCTION 1 diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index e737d43ae2..e4d69c721e 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1246,6 +1246,10 @@ binary_assign_op_addr: { AI_USE_PTR(Ts[opline->result.u.var].var); } NEXT_OPCODE(); + case ZEND_FETCH_UNSET: + zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); + AI_USE_PTR(Ts[opline->result.u.var].var); + NEXT_OPCODE(); case ZEND_FETCH_IS: zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC); AI_USE_PTR(Ts[opline->result.u.var].var); @@ -1277,6 +1281,13 @@ binary_assign_op_addr: { AI_USE_PTR(Ts[opline->result.u.var].var); } NEXT_OPCODE(); + case ZEND_FETCH_DIM_UNSET: + if (opline->extended_value == ZEND_FETCH_ADD_LOCK) { + PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr); + } + zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); + AI_USE_PTR(Ts[opline->result.u.var].var); + NEXT_OPCODE(); case ZEND_FETCH_OBJ_R: zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); AI_USE_PTR(Ts[opline->result.u.var].var); @@ -1300,6 +1311,10 @@ binary_assign_op_addr: { AI_USE_PTR(Ts[opline->result.u.var].var); } NEXT_OPCODE(); + case ZEND_FETCH_OBJ_UNSET: + zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); + AI_USE_PTR(Ts[opline->result.u.var].var); + NEXT_OPCODE(); case ZEND_FETCH_DIM_TMP_VAR: zend_fetch_dimension_address_from_tmp_var(&opline->result, &opline->op1, &opline->op2, Ts ELS_CC); AI_USE_PTR(Ts[opline->result.u.var].var); |