]> granicus.if.org Git - php/commitdiff
MFH
authorHarald Radi <phanto@php.net>
Sat, 27 Apr 2002 10:28:52 +0000 (10:28 +0000)
committerHarald Radi <phanto@php.net>
Sat, 27 Apr 2002 10:28:52 +0000 (10:28 +0000)
ext/com/COM.c
ext/com/com.h
ext/rpc/com/com_wrapper.c
ext/rpc/com/com_wrapper.h

index 92128ad0c2e654c56cc4211d3e8153dded1cb5fc..58ab66065051d91c54b4284dd6ec0fedaee4baaa 100644 (file)
@@ -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);
                        }
                }
index 99c17782dfda07b382594d316386a7da32930b9f..62d08c3acd9a2b9ded84b6e722051a00f40002d0 100644 (file)
@@ -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()
 
index 92128ad0c2e654c56cc4211d3e8153dded1cb5fc..58ab66065051d91c54b4284dd6ec0fedaee4baaa 100644 (file)
@@ -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);
                        }
                }
index 99c17782dfda07b382594d316386a7da32930b9f..62d08c3acd9a2b9ded84b6e722051a00f40002d0 100644 (file)
@@ -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()