summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2000-11-09 22:11:14 +0000
committerAndi Gutmans <andi@php.net>2000-11-09 22:11:14 +0000
commitd9d4824cd302ffb0d92ce5d684cd1a54803f1a30 (patch)
tree78bfdebfeda62a8038d772d5a1651e443dff6798 /Zend/zend_compile.c
parentecaf64a362f36f01c4203e0f4eaac2031b872ad7 (diff)
downloadphp-git-d9d4824cd302ffb0d92ce5d684cd1a54803f1a30.tar.gz
- Commit experimental patch to fix the problem when doing $a = new foo()
and the constructor assigns $this by reference to other symbol table elements. Thanks to Daniel J. Rodriguez on this one.
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 33616a0d5a..3c51e21a11 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -303,7 +303,15 @@ void zend_do_echo(znode *arg CLS_DC)
void zend_do_assign(znode *result, znode *variable, znode *value CLS_DC)
{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
+ zend_op *opline;
+
+ if (value->u.EA.type & EXT_TYPE_NEW_OP) {
+ value->u.EA.type &= ~EXT_TYPE_NEW_OP;
+ zend_do_assign_ref(result, variable, value CLS_CC);
+ return;
+ }
+
+ opline = get_next_op(CG(active_op_array) CLS_CC);
opline->opcode = ZEND_ASSIGN;
opline->result.op_type = IS_VAR;
@@ -1649,6 +1657,7 @@ void zend_do_begin_new_object(znode *new_token, znode *class_name CLS_DC)
opline->opcode = ZEND_NEW;
opline->result.op_type = IS_VAR;
opline->result.u.var = get_temporary_variable(CG(active_op_array));
+ opline->result.u.EA.type |= EXT_TYPE_NEW_OP;
opline->op1 = *class_name;
SET_UNUSED(opline->op2);