]> granicus.if.org Git - php/commitdiff
MFZE1 global declare
authorJason Greene <jason@php.net>
Tue, 30 Jul 2002 22:19:50 +0000 (22:19 +0000)
committerJason Greene <jason@php.net>
Tue, 30 Jul 2002 22:19:50 +0000 (22:19 +0000)
Zend/zend_compile.c
Zend/zend_execute.c
Zend/zend_globals.h

index e1cac9175ec3ec756cd92ce9201a46626df9e4db..99aa9709a76c32c15096eb6577aecf43370fdf11 100644 (file)
@@ -2864,6 +2864,7 @@ void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS
 void zend_do_declare_begin(TSRMLS_D)
 {
        zend_stack_push(&CG(declare_stack), &CG(declarables), sizeof(zend_declarables));
+       CG(declarables).beginop = get_next_op_number(CG(active_op_array));
 }
 
 
@@ -2884,7 +2885,10 @@ void zend_do_declare_end(TSRMLS_D)
        zend_declarables *declarables;
 
        zend_stack_top(&CG(declare_stack), (void **) &declarables);
-       CG(declarables) = *declarables;
+       /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */
+       if ((get_next_op_number(CG(active_op_array)) - CG(declarables).beginop) - ((CG(declarables).ticks.value.lval)?1:0)) {
+               CG(declarables) = *declarables;
+       }
 }
 
 
index 3b1f98299af32bf48911c7882a2650f360bb7a5d..573e2c384dabc6ae97efc98703ed65f3e513278a 100644 (file)
@@ -3108,7 +3108,7 @@ send_by_ref:
                                do_bind_function_or_class(EX(opline), EG(function_table), EG(class_table), 0);
                                NEXT_OPCODE();
                        case ZEND_TICKS:
-                               if (++EG(ticks_count)==EX(opline)->op1.u.constant.value.lval) {
+                               if (++EG(ticks_count)>=EX(opline)->op1.u.constant.value.lval) {
                                        EG(ticks_count)=0;
                                        if (zend_ticks_function) {
                                                zend_ticks_function(EX(opline)->op1.u.constant.value.lval);
index fa9cde9cf11b54bf0ff621df1c494bc6b44915fe..969222e08219c5ad4d91d9028b55b6023d11e365 100644 (file)
@@ -58,6 +58,7 @@ END_EXTERN_C()
 
 typedef struct _zend_declarables {
        zval ticks;
+       zend_uint beginop;
 } zend_declarables;