1
0
mirror of https://github.com/php/php-src.git synced 2026-04-02 21:52:36 +02:00

- This hopefully fixes the list($a, $a) = array(1,2) crash, i.e. when list

by mistake contains the same variable twice.
- BTW, there is no defined order of assignment. The value of $a after the
  previous example is undefined, and should not be assumed to be either 1
  nor 2.
This commit is contained in:
Andi Gutmans
2000-02-05 20:19:46 +00:00
parent 1616b5193c
commit 7f48989be6
2 changed files with 3 additions and 7 deletions

View File

@@ -644,7 +644,7 @@ assignment_list:
assignment_list_element:
w_cvar { do_add_list_element(&$1 CLS_CC); }
cvar { do_add_list_element(&$1 CLS_CC); }
| T_LIST '(' { do_new_list_begin(CLS_C); } assignment_list ')' { do_new_list_end(CLS_C); }
| /* empty */ { do_add_list_element(NULL CLS_CC); }
;

View File

@@ -1758,7 +1758,7 @@ void do_add_list_element(znode *element CLS_DC)
if (element) {
lle.var = *element;
zend_llist_copy(&lle.dimensions, &CG(dimension_llist));
zend_llist_add_element(&CG(list_llist), &lle);
zend_llist_prepend_element(&CG(list_llist), &lle);
}
(*((int *)CG(dimension_llist).tail->data))++;
}
@@ -1827,11 +1827,7 @@ void do_list_end(znode *result, znode *expr CLS_DC)
}
((list_llist_element *) le->data)->value = last_container;
zend_llist_destroy(&((list_llist_element *) le->data)->dimensions);
le = le->next;
}
le = CG(list_llist).head;
while (le) {
do_end_variable_parse(BP_VAR_W, 0 CLS_CC);
do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value CLS_CC);
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
le = le->next;