]> granicus.if.org Git - php/commitdiff
- Fix crash bug in interactive mode
authorAndi Gutmans <andi@php.net>
Mon, 30 Apr 2001 04:50:34 +0000 (04:50 +0000)
committerAndi Gutmans <andi@php.net>
Mon, 30 Apr 2001 04:50:34 +0000 (04:50 +0000)
Zend/zend_execute_API.c

index 5a71c660c1c6dbdd63c5ffdfd5212ba459729351..1757d8bfb14caeb59f27702802ecca0d44f9626e 100644 (file)
@@ -557,6 +557,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name CLS
 #if SUPPORT_INTERACTIVE
 void execute_new_code(CLS_D)
 {
+    zend_op *opline, *end;
        ELS_FETCH();
 
        if (!EG(interactive)
@@ -565,6 +566,22 @@ void execute_new_code(CLS_D)
                || CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
                return;
        }
+
+    opline=CG(active_op_array)->opcodes + CG(active_op_array)->start_op_number;
+       end=opline+CG(active_op_array)->last;
+
+    while (opline<end) {
+        if (opline->op1.op_type==IS_CONST) {
+            opline->op1.u.constant.is_ref = 1;
+            opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
+        }
+        if (opline->op2.op_type==IS_CONST) {
+            opline->op2.u.constant.is_ref = 1;
+            opline->op2.u.constant.refcount = 2;
+        }
+        opline++;
+    }
+
        CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number;
        CG(active_op_array)->end_op_number = CG(active_op_array)->last;
        EG(active_op_array) = CG(active_op_array);