Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h

From: Date: Mon, 20 Feb 2006 19:40:16 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h
References: 1 2  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4593@lists.php.net to get a copy of this message
Hello Dmitry, as the documentation explicitly states: "private to FE_FETCH" nobody should use this. So the fix would be to drop its usage there. regards marcus Monday, February 20, 2006, 11:29:42 AM, you wrote: > Hi Marcus, > Note that this patch broke iterators in ext/dom. > I fixed them. > Please verify. > Thanks. Dmitry. >> -----Original Message----- >> From: Marcus Boerger [mailto:helly@php.net] >> Sent: Saturday, February 18, 2006 8:38 PM >> To: zend-engine-cvs@lists.php.net >> Subject: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_vm_def.h >> zend_vm_execute.h >> >> >> helly Sat Feb 18 17:37:55 2006 UTC >> >> Modified files: >> /ZendEngine2 zend_vm_def.h zend_vm_execute.h >> Log: >> - Fix integrated iterator index >> >> ÄWD9 ¡ >> ÓjMÚ8º!âhttp://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_vm_def.h?r1=1. >> 93&r2=1.94&diff_format=u >> Index: ZendEngine2/zend_vm_def.h >> diff -u ZendEngine2/zend_vm_def.h:1.93 ZendEngine2/zend_vm_def.h:1.94 >> --- ZendEngine2/zend_vm_def.h:1.93 Mon Feb 6 11:46:12 2006 >> +++ ZendEngine2/zend_vm_def.h Sat Feb 18 17:37:54 2006 >> @@ -18,7 +18,7 @@ >> >> +------------------------------------------------------------- >> ---------+ >> */ >> >> -/* $Id: zend_vm_def.h,v 1.93 2006/02/06 11:46:12 dmitry Exp $ */ >> +/* $Id: zend_vm_def.h,v 1.94 2006/02/18 17:37:54 helly Exp $ */ >> >> /* If you change this file, please regenerate the >> zend_vm_execute.h and >> * zend_vm_opcodes.h files by running: >> @@ -3118,6 +3118,7 @@ >> zval_ptr_dtor(&array_ptr); >> ZEND_VM_NEXT_OPCODE(); >> } >> + iter->index = -1; /* will be set to 0 before >> using next handler */ >> } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { >> zend_hash_internal_pointer_reset(fe_ht); >> if (ce) { >> @@ -3218,7 +3219,7 @@ >> >> case ZEND_ITER_OBJECT: >> /* !iter happens from exception */ >> - if (iter && iter->index++) { >> + if (iter && ++iter->index > 0) { >> /* This could cause an endless >> loop if index becomes zero again. >> * In case that ever happens we >> need an additional flag. */ >> iter->funcs->move_forward(iter >> TSRMLS_CC); >> @@ -3228,7 +3229,8 @@ >> ZEND_VM_NEXT_OPCODE(); >> } >> } >> - if (!iter || (iter->index > 1 && >> iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { >> + /* If index is zero we come from >> FE_RESET and checked valid() already. */ >> + if (!iter || (iter->index > 0 && >> iter->funcs->valid(iter TSRMLS_CC) >> +== FAILURE)) { >> /* reached end of iteration */ >> if (EG(exception)) { >> array->refcount--; >> @@ -3260,7 +3262,6 @@ >> int_key = iter->index; >> } >> } >> - >> break; >> } >> >> œ@&�˜Á�Ú4†:² >> á€http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_vm_execute.h?r >> 1=1.97&r2=1.98&diff_format=u >> Index: ZendEngine2/zend_vm_execute.h >> diff -u ZendEngine2/zend_vm_execute.h:1.97 >> ZendEngine2/zend_vm_execute.h:1.98 >> --- ZendEngine2/zend_vm_execute.h:1.97 Mon Feb 6 11:46:12 2006 >> +++ ZendEngine2/zend_vm_execute.h Sat Feb 18 17:37:54 2006 >> @@ -2057,6 +2057,7 @@ >> zval_ptr_dtor(&array_ptr); >> ZEND_VM_NEXT_OPCODE(); >> } >> + iter->index = -1; /* will be set to 0 before >> using next handler */ >> } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { >> zend_hash_internal_pointer_reset(fe_ht); >> if (ce) { >> @@ -4557,6 +4558,7 @@ >> zval_ptr_dtor(&array_ptr); >> ZEND_VM_NEXT_OPCODE(); >> } >> + iter->index = -1; /* will be set to 0 before >> using next handler */ >> } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { >> zend_hash_internal_pointer_reset(fe_ht); >> if (ce) { >> @@ -7654,6 +7656,7 @@ >> zval_ptr_dtor(&array_ptr); >> ZEND_VM_NEXT_OPCODE(); >> } >> + iter->index = -1; /* will be set to 0 before >> using next handler */ >> } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { >> zend_hash_internal_pointer_reset(fe_ht); >> if (ce) { >> @@ -7754,7 +7757,7 @@ >> >> case ZEND_ITER_OBJECT: >> /* !iter happens from exception */ >> - if (iter && iter->index++) { >> + if (iter && ++iter->index > 0) { >> /* This could cause an endless >> loop if index becomes zero again. >> * In case that ever happens we >> need an additional flag. */ >> iter->funcs->move_forward(iter >> TSRMLS_CC); >> @@ -7764,7 +7767,8 @@ >> ZEND_VM_NEXT_OPCODE(); >> } >> } >> - if (!iter || (iter->index > 1 && >> iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { >> + /* If index is zero we come from >> FE_RESET and checked valid() already. */ >> + if (!iter || (iter->index > 0 && >> iter->funcs->valid(iter TSRMLS_CC) >> +== FAILURE)) { >> /* reached end of iteration */ >> if (EG(exception)) { >> array->refcount--; >> @@ -7796,7 +7800,6 @@ >> int_key = iter->index; >> } >> } >> - >> break; >> } >> >> @@ -20296,6 +20299,7 @@ >> zval_ptr_dtor(&array_ptr); >> ZEND_VM_NEXT_OPCODE(); >> } >> + iter->index = -1; /* will be set to 0 before >> using next handler */ >> } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { >> zend_hash_internal_pointer_reset(fe_ht); >> if (ce) { >> >> -- >> Zend Engine CVS Mailing List (http://cvs.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> Best regards, Marcus

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