Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute.c

From: Date: Tue, 09 Sep 2003 08:02:44 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1826@lists.php.net to get a copy of this message
The patch looks good - it wasn't jumping to the right place before (the FE_RESET opcode doesn't contain the address to jump to, the following FE_FETCH opcode does), and it wasn't properly locking the variable. At 07:11 08/09/2003, Andi Gutmans wrote:
Can you please explain what the behavior was before and what it is now? Andi At 11:09 PM 9/7/2003 +0000, Marcus Boerger wrote:
helly           Sun Sep  7 19:09:31 2003 EDT
Modified files:
    /ZendEngine2        zend_execute.c
Log: Fix foreach() called with non array Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.536 ZendEngine2/zend_execute.c:1.537
--- ZendEngine2/zend_execute.c:1.536    Thu Sep  4 12:00:01 2003
+++ ZendEngine2/zend_execute.c Sun Sep 7 19:09:30 2003 @@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: zend_execute.c,v 1.536 2003/09/04 16:00:01 helly Exp $ */ +/* $Id: zend_execute.c,v 1.537 2003/09/07 23:09:30 helly Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -3549,20 +3549,20 @@
                }
        }
+       PZVAL_LOCK(array_ptr);
+       EX_T(EX(opline)->result.u.var).var.ptr = array_ptr;
+       EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
+
        if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
                /* probably redundant */
                zend_hash_internal_pointer_reset(fe_ht);
        } else {
                zend_error(E_WARNING, "Invalid argument supplied for foreach()");
-               EX(opline) = op_array->opcodes+EX(opline)->op1.u.opline_num;
+               EX(opline)++;
                EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
                return 0;
        }
-
-       PZVAL_LOCK(array_ptr);
-       EX_T(EX(opline)->result.u.var).var.ptr = array_ptr;
-       EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
        NEXT_OPCODE();
} -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.zend-engine.cvs (#1826) next »