summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-04-19 16:28:05 +0000
committerAndi Gutmans <andi@php.net>1999-04-19 16:28:05 +0000
commitdd03a7a2f344137b161aeaea1af8200a16c00ff4 (patch)
tree0409b891ffe218e290988f74c8c252c5657e5814
parent7dee737fb448b0ab2d35debd358b3c10f01508a8 (diff)
downloadphp-git-dd03a7a2f344137b161aeaea1af8200a16c00ff4.tar.gz
Support =unset as arguments
-rw-r--r--Zend/config.w32.h2
-rw-r--r--Zend/zend-parser.y2
-rw-r--r--Zend/zend_compile.c2
-rw-r--r--Zend/zend_execute.c4
4 files changed, 8 insertions, 2 deletions
diff --git a/Zend/config.w32.h b/Zend/config.w32.h
index 1a416de974..dac03e3b46 100644
--- a/Zend/config.w32.h
+++ b/Zend/config.w32.h
@@ -17,7 +17,7 @@ typedef unsigned int uint;
#undef inline
#endif
-#define ZEND_DEBUG 0
+#define ZEND_DEBUG 1
#define zend_sprintf sprintf
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y
index 3f12046352..520e222778 100644
--- a/Zend/zend-parser.y
+++ b/Zend/zend-parser.y
@@ -257,10 +257,12 @@ non_empty_parameter_list:
| '&' VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); }
| ZEND_CONST VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
| VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$3, BYREF_NONE CLS_CC); }
+ | VARIABLE '=' ZEND_UNSET { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
| non_empty_parameter_list ',' VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
| non_empty_parameter_list ',' '&' VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); }
| non_empty_parameter_list ',' ZEND_CONST VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
| non_empty_parameter_list ',' VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, BYREF_NONE CLS_CC); }
+ | non_empty_parameter_list ',' VARIABLE '=' ZEND_UNSET { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
;
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 4db89e6a3c..01c8ba41e0 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -649,7 +649,7 @@ void do_receive_arg(int op, znode *var, znode *offset, znode *initialization, un
opline->opcode = op;
opline->result = *var;
opline->op1 = *offset;
- if (initialization) {
+ if ((op == ZEND_RECV_INIT) && initialization) {
opline->op2 = *initialization;
} else {
SET_UNUSED(opline->op2);
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index f883453288..eb2dc8873c 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1485,6 +1485,10 @@ send_by_ref:
//if (zend_hash_index_find(EG(active_symbol_table), opline->op1.u.constant.value.lval, (void **) &param)==FAILURE) {
if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param)==FAILURE) {
+ if (opline->op2.op_type == IS_UNUSED) {
+ DEC_AI_COUNT();
+ break;
+ }
if (opline->op2.u.constant.type == IS_CONSTANT) {
zval *default_value = (zval *) emalloc(sizeof(zval));
zval tmp;