cvs: ZendEngine2(PHP_5_3) / zend_compile.c zend_language_parser.y zend_vm_def.h zend_vm_execute.h /tests bug35163.phpt php-src NEWS

From: Date: Tue, 23 Oct 2007 09:55:14 +0000
Subject: cvs: ZendEngine2(PHP_5_3) / zend_compile.c zend_language_parser.y zend_vm_def.h zend_vm_execute.h /tests bug35163.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6102@lists.php.net to get a copy of this message
dmitry Tue Oct 23 09:55:14 2007 UTC Added files: (Branch: PHP_5_3) /ZendEngine2/tests bug35163.phpt Modified files: /php-src NEWS /ZendEngine2 zend_compile.c zend_language_parser.y zend_vm_def.h zend_vm_execute.h Log: Fixed bug #35163 (Array elements can lose references)

http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.31&r2=1.2027.2.547.2.965.2.32&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.31 php-src/NEWS:1.2027.2.547.2.965.2.32 --- php-src/NEWS:1.2027.2.547.2.965.2.31 Wed Oct 17 17:22:52 2007 +++ php-src/NEWS Tue Oct 23 09:55:10 2007 @@ -49,6 +49,7 @@ - Fixed bug #42069 (parse_ini_file() allows using some non-alpha numeric characters). (Jani) - Fixed bug #37911 (preg_replace_callback() ignores named groups). (Nuno) +- Fixed bug #35163 (Array elements can lose references). (Dmitry) - Fixed bug #27372 (parse error loading browscap.ini at apache startup). (Jani) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.10&r2=1.647.2.27.2.41.2.11&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.10 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.11 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.10 Wed Oct 17 10:01:21 2007 +++ ZendEngine2/zend_compile.c Tue Oct 23 09:55:10 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.10 2007/10/17 10:01:21 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.11 2007/10/23 09:55:10 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -927,6 +927,9 @@ if (le == NULL) break; opline_ptr = (zend_op *)le->data; } + if (opline->opcode == ZEND_FETCH_DIM_W) { + opline->extended_value = arg_offset; + } } zend_llist_destroy(fetch_list_ptr); zend_stack_del_top(&CG(bp_stack)); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_parser.y?r1=1.160.2.4.2.8.2.4&r2=1.160.2.4.2.8.2.5&diff_format=u Index: ZendEngine2/zend_language_parser.y diff -u ZendEngine2/zend_language_parser.y:1.160.2.4.2.8.2.4 ZendEngine2/zend_language_parser.y:1.160.2.4.2.8.2.5 --- ZendEngine2/zend_language_parser.y:1.160.2.4.2.8.2.4 Mon Oct 1 10:37:13 2007 +++ ZendEngine2/zend_language_parser.y Tue Oct 23 09:55:10 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_parser.y,v 1.160.2.4.2.8.2.4 2007/10/01 10:37:13 dmitry Exp $ */ +/* $Id: zend_language_parser.y,v 1.160.2.4.2.8.2.5 2007/10/23 09:55:10 dmitry Exp $ */ /* * LALR shift/reduce conflicts and how they are resolved: @@ -567,7 +567,7 @@ expr_without_variable: T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); } | variable '=' expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); } - | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); } + | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 1 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); } | variable '=' '&' T_NEW class_name_reference { zend_error(E_STRICT, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); } | T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.13&r2=1.59.2.29.2.48.2.14&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.13 ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.14 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.13 Sun Oct 7 05:22:03 2007 +++ ZendEngine2/zend_vm_def.h Tue Oct 23 09:55:10 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.13 2007/10/07 05:22:03 davidw Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.14 2007/10/23 09:55:10 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1066,6 +1066,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) { + 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.62.2.30.2.49.2.12&r2=1.62.2.30.2.49.2.13&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.12 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.13 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.12 Sun Oct 7 05:22:03 2007 +++ ZendEngine2/zend_vm_execute.h Tue Oct 23 09:55:10 2007 @@ -9219,6 +9219,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) { + 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(); } @@ -10862,6 +10870,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) { + 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(); } @@ -12441,6 +12457,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) { + 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(); } @@ -13623,6 +13647,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) { + 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(); } @@ -14581,6 +14613,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) { + 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(); } @@ -21692,6 +21732,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + 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); + } + ZEND_VM_NEXT_OPCODE(); } @@ -23171,6 +23218,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + 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); + } + ZEND_VM_NEXT_OPCODE(); } @@ -24653,6 +24707,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + 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); + } + ZEND_VM_NEXT_OPCODE(); } @@ -25737,6 +25798,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + 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); + } + ZEND_VM_NEXT_OPCODE(); } @@ -26605,6 +26673,13 @@ AI_USE_PTR(EX_T(opline->result.u.var).var); } + /* We are going to assign the result by reference */ + 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); + } + ZEND_VM_NEXT_OPCODE(); } http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug35163.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug35163.phpt +++ ZendEngine2/tests/bug35163.phpt
« previous php.zend-engine.cvs (#6102) next »