]> granicus.if.org Git - php/commitdiff
- Fix the annoying problem with list(), that surfaced up after our recent cleaning
authorZeev Suraski <zeev@php.net>
Wed, 2 Feb 2000 16:47:43 +0000 (16:47 +0000)
committerZeev Suraski <zeev@php.net>
Wed, 2 Feb 2000 16:47:43 +0000 (16:47 +0000)
  patches

Zend/zend_compile.c

index d2505b83ddb94c2dd15ea89287f069aec6d1937a..f97d8259790bf442897fefa5a80e924e302e75fc 100644 (file)
@@ -662,15 +662,26 @@ void do_free(znode *op1 CLS_DC)
                        && opline->result.u.var == op1->u.var) {
                        opline->result.u.EA.type |= EXT_TYPE_UNUSED;
                } else {
-                       /* This should be an object instanciation
-                        * Find JMP_NO_CTOR, mark the preceding ASSIGN and the
-                        * proceeding INIT_FCALL_BY_NAME as unused
-                        */
                        while (opline>CG(active_op_array)->opcodes) {
+                               /* This should be an object instanciation
+                                * Find JMP_NO_CTOR, mark the preceding ASSIGN and the
+                                * proceeding INIT_FCALL_BY_NAME as unused
+                                */
                                if (opline->opcode == ZEND_JMP_NO_CTOR) {
                                        (opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED;
                                        (opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED;
                                        break;
+                               } else if (opline->opcode == ZEND_FETCH_DIM_R
+                                                       && opline->op1.op_type == IS_VAR
+                                                       && opline->op1.u.var == op1->u.var) {
+                                       /* This should the end of a list() construct
+                                        * Mark its result as unused
+                                        */
+                                       opline->extended_value = ZEND_FETCH_STANDARD;
+                                       break;
+                               } else if (opline->result.op_type==IS_VAR
+                                       && opline->result.u.var == op1->u.var) {
+                                       break;
                                }
                                opline--;
                        }
@@ -1796,11 +1807,7 @@ void do_list_end(znode *result, znode *expr CLS_DC)
                        opline->op2.u.constant.type = IS_LONG;
                        opline->op2.u.constant.value.lval = *((int *) dimension->data);
                        INIT_PZVAL(&opline->op2.u.constant);
-                       if (le == CG(list_llist).tail) {
-                               opline->extended_value = ZEND_FETCH_STANDARD;
-                       } else {
-                               opline->extended_value = ZEND_FETCH_ADD_LOCK;
-                       }
+                       opline->extended_value = ZEND_FETCH_ADD_LOCK;
                        last_container = opline->result;
                        dimension = dimension->next;
                }