diff options
Diffstat (limited to 'Zend/zend_execute_API.c')
| -rw-r--r-- | Zend/zend_execute_API.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index cf14a2b98..b7b9cef7f 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2007 Zend Technologies Ltd. (http://www.zend.com) | +----------------------------------------------------------------------+ | This source file is subject to version 2.00 of the Zend license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.10 2006/10/18 17:04:49 johannes Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.19 2007/04/27 08:12:24 tony2001 Exp $ */ #include <stdio.h> #include <signal.h> @@ -451,7 +451,7 @@ ZEND_API int zend_is_true(zval *op) ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) { zval *p = *pp; - zend_bool inline_change = (zend_bool) (unsigned long) arg; + zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg; zval const_value; if (Z_TYPE_P(p) == IS_CONSTANT) { @@ -622,6 +622,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS char *fname, *colon; int fname_len; + *fci->retval_ptr_ptr = NULL; + if (!EG(active)) { return FAILURE; /* executor is already inactive */ } @@ -652,11 +654,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS memset(&execute_data, 0, sizeof(zend_execute_data)); } - /* we may return SUCCESS, and yet retval may be uninitialized, - * if there was an exception... - */ - *fci->retval_ptr_ptr = NULL; - if (!fci_cache || !fci_cache->initialized) { if (Z_TYPE_P(fci->function_name)==IS_ARRAY) { /* assume array($obj, $name) couple */ zval **tmp_object_ptr, **tmp_real_function_name; @@ -750,7 +747,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS fname = Z_STRVAL_P(fci->function_name); fname_len = Z_STRLEN_P(fci->function_name); - if (calling_scope && (colon = strstr(fname, "::")) != NULL) { + if ((colon = strstr(fname, "::")) != NULL) { int clen = colon - fname; int mlen = fname_len - clen - 2; zend_class_entry **pce, *ce_child = NULL; @@ -867,9 +864,14 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS if (fci->no_separation) { if(i) { /* hack to clean up the stack */ - zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) i, NULL); + zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (zend_uintptr_t) i, NULL); zend_ptr_stack_clear_multiple(TSRMLS_C); } + + if (call_via_handler) { + zval_ptr_dtor(&method_name); + zval_ptr_dtor(¶ms_array); + } return FAILURE; } ALLOC_ZVAL(new_zval); @@ -903,7 +905,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS fci->param_count = 2; } - zend_ptr_stack_2_push(&EG(argument_stack), (void *) (long) fci->param_count, NULL); + zend_ptr_stack_2_push(&EG(argument_stack), (void *) (zend_uintptr_t) fci->param_count, NULL); original_function_state_ptr = EG(function_state_ptr); EG(function_state_ptr) = &EX(function_state); @@ -1013,7 +1015,7 @@ ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_fcall_info fcall_info; zend_fcall_info_cache fcall_cache; - if (name == NULL) { + if (name == NULL || !name_length) { return FAILURE; } @@ -1113,11 +1115,14 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR int retval; if (retval_ptr) { - pv.value.str.len = strlen(str)+sizeof("return ;")-1; - pv.value.str.val = emalloc(pv.value.str.len+1); - strcpy(pv.value.str.val, "return "); - strcat(pv.value.str.val, str); - strcat(pv.value.str.val, " ;"); + int l = strlen(str); + Z_STRLEN(pv) = l+sizeof("return ;")-1; + Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1); + memcpy(Z_STRVAL(pv), "return ", sizeof("return ")-1); + memcpy(Z_STRVAL(pv) + sizeof("return ")-1, str, l); + Z_STRVAL(pv)[Z_STRLEN(pv)-2] = ' '; + Z_STRVAL(pv)[Z_STRLEN(pv)-1] = ';'; + Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; } else { pv.value.str.len = strlen(str); pv.value.str.val = estrndup(str, pv.value.str.len); @@ -1189,7 +1194,7 @@ void execute_new_code(TSRMLS_D) zend_op *ret_opline; zval *local_retval=NULL; - if (!CG(interactive) + if (!(CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) || CG(active_op_array)->backpatch_count>0 || CG(active_op_array)->function_name || CG(active_op_array)->type!=ZEND_USER_FUNCTION) { @@ -1381,6 +1386,9 @@ void zend_set_timeout(long seconds) TSRMLS_FETCH(); EG(timeout_seconds) = seconds; + if(!seconds) { + return; + } #ifdef ZEND_WIN32 if (timeout_thread_initialized==0 && InterlockedIncrement(&timeout_thread_initialized)==1) { /* We start up this process-wide thread here and not in zend_startup(), because if Zend @@ -1419,7 +1427,9 @@ void zend_set_timeout(long seconds) void zend_unset_timeout(TSRMLS_D) { #ifdef ZEND_WIN32 - PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0); + if(timeout_thread_initialized) { + PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0); + } #else # ifdef HAVE_SETITIMER { |
