From: Harald Radi Date: Sat, 27 Apr 2002 10:28:52 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.2.1RC1~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=568e301e460ea2ec5710786124014376c76c0eeb;p=php MFH --- diff --git a/ext/com/COM.c b/ext/com/COM.c index 92128ad0c2..58ab660650 100644 --- a/ext/com/COM.c +++ b/ext/com/COM.c @@ -133,6 +133,7 @@ PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DIS if (FAILED(hr)) { switch (hr) { case DISP_E_EXCEPTION: { + char *src=estrdup("Unavailable"); int srclen=strlen(src); char *desc=estrdup("Unavailable"); @@ -500,14 +501,11 @@ PHP_FUNCTION(com_load) } if (server_name != NULL) { - /* if a server is passed, one obviously wants to instanciate a - * remote server - */ - flags = CLSCTX_REMOTE_SERVER; - /* What is server name? A String or an array? */ - if (Z_TYPE_P(server_name) == IS_ARRAY) { + if (Z_TYPE_P(server_name) == IS_NULL) { + server_name = NULL; + } else if (Z_TYPE_P(server_name) == IS_ARRAY) { pval **tmp; /* DAB: 22 Sept 2001 */ /* Aha - we have a number of possible */ @@ -567,14 +565,12 @@ PHP_FUNCTION(com_load) convert_to_long_ex(tmp); flags = (CLSCTX) Z_LVAL_PP(tmp); } - } - if (Z_TYPE_P(server_name) == IS_NULL) { - server_name = NULL; } else { if (!INI_INT("com.allow_dcom")) { php_error(E_WARNING, "DCOM is disabled"); RETURN_FALSE; } else { + flags = CLSCTX_REMOTE_SERVER; convert_to_string_ex(&server_name); } } diff --git a/ext/com/com.h b/ext/com/com.h index 99c17782df..62d08c3acd 100644 --- a/ext/com/com.h +++ b/ext/com/com.h @@ -30,8 +30,7 @@ END_EXTERN_C() ALLOC_HASHTABLE(properties); \ zend_hash_init(properties, 0, NULL, ZVAL_PTR_DTOR, 0); \ \ - ALLOC_ZVAL(handle); \ - INIT_PZVAL(handle); \ + MAKE_STD_ZVAL(handle); \ ZVAL_LONG(handle, zend_list_insert((o), IS_COM)); \ \ zval_copy_ctor(handle); \ @@ -46,7 +45,7 @@ END_EXTERN_C() #define ALLOC_COM(z) (z) = (comval *) emalloc(sizeof(comval)); \ C_REFCOUNT(z) = 0; -#define FREE_COM(z) efree(z); +#define FREE_COM(z) php_COM_destruct(z TSRMLS_CC); #define IS_COM php_COM_get_le_comval() diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c index 92128ad0c2..58ab660650 100644 --- a/ext/rpc/com/com_wrapper.c +++ b/ext/rpc/com/com_wrapper.c @@ -133,6 +133,7 @@ PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DIS if (FAILED(hr)) { switch (hr) { case DISP_E_EXCEPTION: { + char *src=estrdup("Unavailable"); int srclen=strlen(src); char *desc=estrdup("Unavailable"); @@ -500,14 +501,11 @@ PHP_FUNCTION(com_load) } if (server_name != NULL) { - /* if a server is passed, one obviously wants to instanciate a - * remote server - */ - flags = CLSCTX_REMOTE_SERVER; - /* What is server name? A String or an array? */ - if (Z_TYPE_P(server_name) == IS_ARRAY) { + if (Z_TYPE_P(server_name) == IS_NULL) { + server_name = NULL; + } else if (Z_TYPE_P(server_name) == IS_ARRAY) { pval **tmp; /* DAB: 22 Sept 2001 */ /* Aha - we have a number of possible */ @@ -567,14 +565,12 @@ PHP_FUNCTION(com_load) convert_to_long_ex(tmp); flags = (CLSCTX) Z_LVAL_PP(tmp); } - } - if (Z_TYPE_P(server_name) == IS_NULL) { - server_name = NULL; } else { if (!INI_INT("com.allow_dcom")) { php_error(E_WARNING, "DCOM is disabled"); RETURN_FALSE; } else { + flags = CLSCTX_REMOTE_SERVER; convert_to_string_ex(&server_name); } } diff --git a/ext/rpc/com/com_wrapper.h b/ext/rpc/com/com_wrapper.h index 99c17782df..62d08c3acd 100644 --- a/ext/rpc/com/com_wrapper.h +++ b/ext/rpc/com/com_wrapper.h @@ -30,8 +30,7 @@ END_EXTERN_C() ALLOC_HASHTABLE(properties); \ zend_hash_init(properties, 0, NULL, ZVAL_PTR_DTOR, 0); \ \ - ALLOC_ZVAL(handle); \ - INIT_PZVAL(handle); \ + MAKE_STD_ZVAL(handle); \ ZVAL_LONG(handle, zend_list_insert((o), IS_COM)); \ \ zval_copy_ctor(handle); \ @@ -46,7 +45,7 @@ END_EXTERN_C() #define ALLOC_COM(z) (z) = (comval *) emalloc(sizeof(comval)); \ C_REFCOUNT(z) = 0; -#define FREE_COM(z) efree(z); +#define FREE_COM(z) php_COM_destruct(z TSRMLS_CC); #define IS_COM php_COM_get_le_comval()