cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_vm_def.h zend_vm_execute.h /tests bug35163_2.phpt bug35163_3.phpt

From: Date: Tue, 23 Oct 2007 12:52:51 +0000
Subject: cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_vm_def.h zend_vm_execute.h /tests bug35163_2.phpt bug35163_3.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6105@lists.php.net to get a copy of this message
dmitry Tue Oct 23 12:52:51 2007 UTC Modified files: /ZendEngine2 zend_compile.c zend_compile.h zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests bug35163_2.phpt bug35163_3.phpt Log: Fixed variations of bug #35163

http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.774&r2=1.775&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.774 ZendEngine2/zend_compile.c:1.775 --- ZendEngine2/zend_compile.c:1.774 Tue Oct 23 09:55:25 2007 +++ ZendEngine2/zend_compile.c Tue Oct 23 12:52:51 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.774 2007/10/23 09:55:25 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.775 2007/10/23 12:52:51 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -988,8 +988,8 @@ if (le == NULL) break; opline_ptr = (zend_op *)le->data; } - if (opline->opcode == ZEND_FETCH_DIM_W) { - opline->extended_value = arg_offset; + if (type == BP_VAR_W && arg_offset) { + opline->extended_value = ZEND_FETCH_MAKE_REF; } } zend_llist_destroy(fetch_list_ptr); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.366&r2=1.367&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.366 ZendEngine2/zend_compile.h:1.367 --- ZendEngine2/zend_compile.h:1.366 Wed Oct 3 10:33:45 2007 +++ ZendEngine2/zend_compile.h Tue Oct 23 12:52:51 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.366 2007/10/03 10:33:45 dmitry Exp $ */ +/* $Id: zend_compile.h,v 1.367 2007/10/23 12:52:51 dmitry Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -692,7 +692,8 @@ #define ZEND_HANDLE_STREAM 5 #define ZEND_FETCH_STANDARD 0 -#define ZEND_FETCH_ADD_LOCK 1 +#define ZEND_FETCH_ADD_LOCK (1<<0) +#define ZEND_FETCH_MAKE_REF (1<<1) #define ZEND_FE_FETCH_BYREF 1 #define ZEND_FE_FETCH_WITH_KEY 2 http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.193&r2=1.194&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.193 ZendEngine2/zend_vm_def.h:1.194 --- ZendEngine2/zend_vm_def.h:1.193 Tue Oct 23 09:55:25 2007 +++ ZendEngine2/zend_vm_def.h Tue Oct 23 12:52:51 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.193 2007/10/23 09:55:25 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.194 2007/10/23 12:52:51 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1014,6 +1014,9 @@ zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_LOCK(*retval); switch (type) { @@ -1104,7 +1107,7 @@ FREE_OP1_VAR_PTR(); /* We are going to assign the result by reference */ - if (opline->extended_value) { + if (opline->extended_value) { Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); @@ -1275,7 +1278,7 @@ zend_free_op free_op1, free_op2; zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && OP1_TYPE != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && OP1_TYPE != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -1295,6 +1298,14 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } FREE_OP1_VAR_PTR(); + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.197&r2=1.198&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.197 ZendEngine2/zend_vm_execute.h:1.198 --- ZendEngine2/zend_vm_execute.h:1.197 Tue Oct 23 09:55:25 2007 +++ ZendEngine2/zend_vm_execute.h Tue Oct 23 12:52:51 2007 @@ -1353,6 +1353,9 @@ zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_LOCK(*retval); switch (type) { @@ -4557,6 +4560,9 @@ zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_LOCK(*retval); switch (type) { @@ -7751,6 +7757,9 @@ zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_LOCK(*retval); switch (type) { @@ -9825,7 +9834,7 @@ zend_free_op free_op1; zval *property = &opline->op2.u.constant; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_VAR != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -9845,6 +9854,14 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -11561,7 +11578,7 @@ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_VAR != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -11581,6 +11598,14 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -13206,7 +13231,7 @@ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_VAR != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -13226,6 +13251,14 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -15422,7 +15455,7 @@ zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_VAR != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -15442,6 +15475,14 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -16808,7 +16849,7 @@ zend_free_op free_op1; zval *property = &opline->op2.u.constant; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_UNUSED != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -16828,6 +16869,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -17893,7 +17941,7 @@ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_UNUSED != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -17913,6 +17961,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -18912,7 +18967,7 @@ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_UNUSED != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -18932,6 +18987,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -20196,7 +20258,7 @@ zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_UNUSED != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -20216,6 +20278,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -21021,6 +21090,9 @@ zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_LOCK(*retval); switch (type) { @@ -22920,7 +22992,7 @@ zend_free_op free_op1; zval *property = &opline->op2.u.constant; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_CV != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -22940,6 +23012,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -24490,7 +24569,7 @@ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_CV != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -24510,6 +24589,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -26036,7 +26122,7 @@ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_CV != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -26056,6 +26142,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -28060,7 +28153,7 @@ zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) && IS_CV != IS_CV) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -28080,6 +28173,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug35163_2.phpt?r1=1.1&r2=1.2&diff_format=u Index: ZendEngine2/tests/bug35163_2.phpt diff -u /dev/null ZendEngine2/tests/bug35163_2.phpt:1.2 --- /dev/null Tue Oct 23 12:52:51 2007 +++ ZendEngine2/tests/bug35163_2.phpt Tue Oct 23 12:52:51 2007 @@ -0,0 +1,65 @@ +--TEST-- +Bug #35163.2 (Array elements can lose references) +--FILE-- +<?php +$a = array(1); +$b = 'a'; +${$b}[] =& $$b; +${$b}[] =& $$b; +${$b}[0] = 2; +var_dump($a); +$a[0] = null; +$a = null; +?> +--EXPECT-- +array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} + http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug35163_3.phpt?r1=1.1&r2=1.2&diff_format=u Index: ZendEngine2/tests/bug35163_3.phpt diff -u /dev/null ZendEngine2/tests/bug35163_3.phpt:1.2 --- /dev/null Tue Oct 23 12:52:51 2007 +++ ZendEngine2/tests/bug35163_3.phpt Tue Oct 23 12:52:51 2007 @@ -0,0 +1,65 @@ +--TEST-- +Bug #35163.3 (Array elements can lose references) +--FILE-- +<?php +$a = new stdClass; +$a->b = array(1); +$a->b[] =& $a->b; +$a->b[] =& $a->b; +$a->b[0] = 2; +var_dump($a); +$a->b = null; +$a = null; +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["b"]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} +--UEXPECT-- +object(stdClass)#1 (1) { + [u"b"]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +}
« previous php.zend-engine.cvs (#6105) next »