cvs: ZendEngine2 / zend_compile.c

From: Date: Tue, 02 Mar 2004 08:28:14 +0000
Subject: cvs: ZendEngine2 / zend_compile.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2435@lists.php.net to get a copy of this message
andi Tue Mar 2 03:28:14 2004 EDT Modified files: /ZendEngine2 zend_compile.c Log: - Fix crash in: <?php class Foo { public $attributes= array(); function export() { foreach ($this->attributes as $name => $attr) { } } } $f= new Foo(); $f->export(); ?> http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.549&r2=1.550&ty=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.549 ZendEngine2/zend_compile.c:1.550 --- ZendEngine2/zend_compile.c:1.549 Sun Feb 29 13:25:50 2004 +++ ZendEngine2/zend_compile.c Tue Mar 2 03:28:12 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.549 2004/02/29 18:25:50 andi Exp $ */ +/* $Id: zend_compile.c,v 1.550 2004/03/02 08:28:12 andi Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -3275,9 +3275,11 @@ } zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); if (CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode == ZEND_FETCH_OBJ_W) { - /* FIXME: This will cause a leak, we have to unlock at the end of foreach() */ - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].extended_value |= ZEND_FETCH_ADD_LOCK; - push_container = 1; + /* Only lock the container if we are fetching from a real container and not $this */ + if (CG(active_op_array)->opcodes[CG(active_op_array)->last-1].op1.op_type == IS_VAR) { + CG(active_op_array)->opcodes[CG(active_op_array)->last-1].extended_value |= ZEND_FETCH_ADD_LOCK; + push_container = 1; + } } } else { is_variable = 0;

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