cvs: ZendEngine2 / zend_compile.c zend_execute.c
| From: | Marcus Boerger | Date: | Sun, 17 Aug 2003 12:17:35 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1638@lists.php.net to get a copy of this message | ||
helly Sun Aug 17 08:17:35 2003 EDT
Modified files:
/ZendEngine2 zend_compile.c zend_execute.c
Log:
Implement a TBD: JMP to the end of foreach
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.460 ZendEngine2/zend_compile.c:1.461
--- ZendEngine2/zend_compile.c:1.460 Sun Aug 17 08:16:10 2003
+++ ZendEngine2/zend_compile.c Sun Aug 17 08:17:34 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.460 2003/08/17 12:16:10 helly Exp $ */
+/* $Id: zend_compile.c,v 1.461 2003/08/17 12:17:34 helly Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -2974,7 +2974,7 @@
zend_stack_push(&CG(foreach_copy_stack), (void *) &opline->result, sizeof(znode));
/* save the location of the beginning of the loop (array fetching) */
- foreach_token->u.opline_num = get_next_op_number(CG(active_op_array));
+ opline->op2.u.opline_num = foreach_token->u.opline_num =
get_next_op_number(CG(active_op_array));
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_FE_FETCH;
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.520 ZendEngine2/zend_execute.c:1.521
--- ZendEngine2/zend_execute.c:1.520 Fri Aug 15 17:02:35 2003
+++ ZendEngine2/zend_execute.c Sun Aug 17 08:17:34 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.520 2003/08/15 21:02:35 sas Exp $ */
+/* $Id: zend_execute.c,v 1.521 2003/08/17 12:17:34 helly Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -3508,16 +3508,22 @@
array_ptr->refcount++;
}
}
- 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 {
- /* JMP to the end of foreach - TBD */
+ zend_error(E_WARNING, "Invalid argument supplied for foreach()");
+
+ EX(opline) = op_array->opcodes+EX(opline)->op1.u.opline_num;
+ 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();
}