| Dmitry Stogov 2005-10-17, 3:55 am |
| dmitry Mon Oct 17 03:57:01 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src NEWS
/ZendEngine2 zend_compile.c zend_language_parser.y
Log:
Fixed bug #34873 (Segmentation Fault on foreach in object)
http://cvs.php.net/diff.php/php-src...2027.2.132&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.131 php-src/NEWS:1.2027.2.132
--- php-src/NEWS:1.2027.2.131 Sun Oct 16 13:54:31 2005
+++ php-src/NEWS Mon Oct 17 03:56:55 2005
@@ -1,6 +1,7 @@
PHP NEWS
||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||
?? Oct 2005, PHP 5.1 Release Candidate 3
+- Fixed bug #34873 (Segmentation Fault on foreach in object). (Dmitry)
14 Oct 2005, PHP 5.1 Release Candidate 2
- Changed SQLite extension to be a shared module in Windows distribution.
http://cvs.php.net/diff.php/ZendEng...1.647.2.10&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.9 ZendEngine2/zend_compile.c:1.647.2.10
--- ZendEngine2/zend_compile.c:1.647.2.9 Mon Oct 10 06:50:16 2005
+++ ZendEngine2/zend_compile.c Mon Oct 17 03:56:58 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647.2.9 2005/10/10 10:50:16 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.10 2005/10/17 07:56:58 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -3636,7 +3636,8 @@
}
value_node = opline->result;
- if (assign_by_ref) {
+ zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
+ if (assign_by_ref) {
/* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */
zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC);
} else {
@@ -3647,7 +3648,8 @@
if (key->op_type != IS_UNUSED) {
znode key_node;
- opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
+ zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
+ opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
opline->result.op_type = IS_TMP_VAR;
opline->result.u.EA.type = 0;
opline->result.u.opline_num = get_temporary_variable(CG(active_op_arra
y));
http://cvs.php.net/diff.php/ZendEng...=1.160.2.2&ty=u
Index: ZendEngine2/zend_language_parser.y
diff -u ZendEngine2/zend_language_parser.y:1.160.2.1 ZendEngine2/zend_language_parser.y:1.160.2.2
--- ZendEngine2/zend_language_parser.y:1.160.2.1 Wed Sep 21 05:56:51 2005
+++ ZendEngine2/zend_language_parser.y Mon Oct 17 03:57:00 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_language_parser.y,v 1.160.2.1 2005/09/21 09:56:51 helly Exp $ */
+/* $Id: zend_language_parser.y,v 1.160.2.2 2005/10/17 07:57:00 dmitry Exp $ */
/*
* LALR shift/reduce conflicts and how they are resolved:
@@ -220,7 +220,7 @@
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
| T_FOREACH '(' expr_without_variable { zend_do_foreach_begin(&$1, &$2, &$3, 0 TSRMLS_CC); } T_AS
{ zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); }
- w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
+ variable foreach_optional_arg ')' { zend_check_writable_variable(&$7); zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
| T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array));
zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
| ';' /* empty statement */
@@ -338,8 +338,8 @@
foreach_variable:
- w_variable { $$ = $1; }
- | '&' w_variable { $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
+ variable { zend_check_writable_variable(&$1); $$ = $1; }
+ | '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
;
for_statement:
|