diff options
-rw-r--r-- | Zend/zend.c | 11 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 10 | ||||
-rw-r--r-- | Zend/zend_globals.h | 3 |
3 files changed, 12 insertions, 12 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index 6eb3e931b6..56e50c082d 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -794,6 +794,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co int i; zend_file_handle *file_handle; zend_op_array *orig_op_array = EG(active_op_array); + zval *local_retval=NULL; va_start(files, file_count); for (i=0; i<file_count; i++) { @@ -804,14 +805,12 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC); zend_destroy_file_handle(file_handle TSRMLS_CC); if (EG(active_op_array)) { + EG(return_value_ptr_ptr) = retval ? retval : &local_retval; zend_execute(EG(active_op_array) TSRMLS_CC); - zval_ptr_dtor(EG(return_value_ptr_ptr)); - if (retval) { - EG(return_value_ptr_ptr) = retval; - } else { - EG(return_value_ptr_ptr) = &EG(global_return_value_ptr); + if (!retval) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + local_retval = NULL; } - EG(global_return_value_ptr) = NULL; destroy_op_array(EG(active_op_array)); efree(EG(active_op_array)); } else if (type==ZEND_REQUIRE) { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 2a0b042e03..abacd87026 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -121,8 +121,7 @@ void init_executor(TSRMLS_D) #if 0&&ZEND_DEBUG original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv); #endif - EG(return_value_ptr_ptr) = &EG(global_return_value_ptr); - EG(global_return_value_ptr) = NULL; + EG(return_value_ptr_ptr) = NULL; EG(symtable_cache_ptr) = EG(symtable_cache)-1; EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1; @@ -608,6 +607,7 @@ void execute_new_code(TSRMLS_D) { zend_op *opline, *end; zend_op *ret_opline; + zval *local_retval=NULL; if (!CG(interactive) || CG(active_op_array)->backpatch_count>0 @@ -641,9 +641,13 @@ void execute_new_code(TSRMLS_D) opline++; } + EG(return_value_ptr_ptr) = &local_retval; EG(active_op_array) = CG(active_op_array); zend_execute(CG(active_op_array) TSRMLS_CC); - zval_ptr_dtor(EG(return_value_ptr_ptr)); + if (local_retval) { + zval_ptr_dtor(&local_retval); + } + CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */ CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last; } diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 814f65be77..d3132e2b7a 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -143,9 +143,6 @@ struct _zend_executor_globals { zend_function_state *function_state_ptr; zend_ptr_stack arg_types_stack; - /* for global return() support */ - zval *global_return_value_ptr; - /* symbol table cache */ HashTable *symtable_cache[SYMTABLE_CACHE_SIZE]; HashTable **symtable_cache_limit; |