rrichards               Sun Nov 27 07:21:13 2005 EDT

  Modified files:              
    /php-src/ext/com_dotnet     com_handlers.c com_misc.c com_saproxy.c 
                                com_variant.c php_com_dotnet_internal.h 
  Log:
  Fixed bug #35316 (Application exception trying to create COM object)
  Fix some handler signatures causing memory corruption
  Various unicode fixes
  
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_handlers.c?r1=1.31&r2=1.32&ty=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.31 
php-src/ext/com_dotnet/com_handlers.c:1.32
--- php-src/ext/com_dotnet/com_handlers.c:1.31  Sat Aug 13 15:03:58 2005
+++ php-src/ext/com_dotnet/com_handlers.c       Sun Nov 27 07:21:12 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_handlers.c,v 1.31 2005/08/13 19:03:58 wez Exp $ */
+/* $Id: com_handlers.c,v 1.32 2005/11/27 12:21:12 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -486,17 +486,13 @@
        return ret;
 }
 
-static int com_object_cast(zval *readobj, zval *writeobj, int type, int 
should_free TSRMLS_DC)
+static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
 {
        php_com_dotnet_object *obj;
        VARIANT v;
        VARTYPE vt = VT_EMPTY;
        zval free_obj;
        HRESULT res = S_OK;
-       
-       if (should_free) {
-               free_obj = *writeobj;
-       }
 
        obj = CDNO_FETCH(readobj);
        ZVAL_NULL(writeobj);
@@ -539,10 +535,6 @@
 
        VariantClear(&v);
 
-       if (should_free) {
-               zval_dtor(&free_obj);
-       }
-
        if (SUCCEEDED(res)) {
                return SUCCESS;
        }
@@ -678,6 +670,7 @@
        VariantInit(&obj->v);
        obj->code_page = CP_ACP;
        obj->ce = ce;
+       obj->zo.ce = ce;
 
        retval.handle = zend_objects_store_put(obj, NULL, 
php_com_object_free_storage, php_com_object_clone TSRMLS_CC);
        retval.handlers = &php_com_object_handlers;
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_misc.c?r1=1.8&r2=1.9&ty=u
Index: php-src/ext/com_dotnet/com_misc.c
diff -u php-src/ext/com_dotnet/com_misc.c:1.8 
php-src/ext/com_dotnet/com_misc.c:1.9
--- php-src/ext/com_dotnet/com_misc.c:1.8       Wed Aug  3 10:06:42 2005
+++ php-src/ext/com_dotnet/com_misc.c   Sun Nov 27 07:21:12 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_misc.c,v 1.8 2005/08/03 14:06:42 sniper Exp $ */
+/* $Id: com_misc.c,v 1.9 2005/11/27 12:21:12 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -36,7 +36,7 @@
                message = php_win_err(code);
                free_msg = 1;
        }
-       zend_throw_exception(php_com_exception_class_entry, message, (long)code 
TSRMLS_CC);
+       zend_throw_exception(U_CLASS_ENTRY(php_com_exception_class_entry), 
message, (long)code TSRMLS_CC);
        if (free_msg) {
                LocalFree(message);
        }
@@ -51,6 +51,7 @@
        memset(obj, 0, sizeof(*obj));
        obj->code_page = codepage;
        obj->ce = php_com_variant_class_entry;
+       obj->zo.ce = php_com_variant_class_entry;
 
        VariantInit(&obj->v);
        V_VT(&obj->v) = VT_DISPATCH;
@@ -73,6 +74,7 @@
        memset(obj, 0, sizeof(*obj));
        obj->code_page = codepage;
        obj->ce = php_com_variant_class_entry;
+       obj->zo.ce = php_com_variant_class_entry;
 
        VariantInit(&obj->v);
        VariantCopyInd(&obj->v, v);
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_saproxy.c?r1=1.15&r2=1.16&ty=u
Index: php-src/ext/com_dotnet/com_saproxy.c
diff -u php-src/ext/com_dotnet/com_saproxy.c:1.15 
php-src/ext/com_dotnet/com_saproxy.c:1.16
--- php-src/ext/com_dotnet/com_saproxy.c:1.15   Wed Aug  3 10:06:42 2005
+++ php-src/ext/com_dotnet/com_saproxy.c        Sun Nov 27 07:21:12 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_saproxy.c,v 1.15 2005/08/03 14:06:42 sniper Exp $ */
+/* $Id: com_saproxy.c,v 1.16 2005/11/27 12:21:12 rrichards Exp $ */
 
 /* This module implements a SafeArray proxy which is used internally
  * by the engine when resolving multi-dimensional array accesses on
@@ -323,7 +323,7 @@
        return NULL;
 }
 
-static union _zend_function *saproxy_method_get(zval *object, char *name, int 
len TSRMLS_DC)
+static union _zend_function *saproxy_method_get(zval **object, char *name, int 
len TSRMLS_DC)
 {
        /* no methods */
        return NULL;
@@ -357,7 +357,7 @@
        return -1;
 }
 
-static int saproxy_object_cast(zval *readobj, zval *writeobj, int type, int 
should_free TSRMLS_DC)
+static int saproxy_object_cast(zval *readobj, zval *writeobj, int type 
TSRMLS_DC)
 {
        return FAILURE;
 }
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_variant.c?r1=1.13&r2=1.14&ty=u
Index: php-src/ext/com_dotnet/com_variant.c
diff -u php-src/ext/com_dotnet/com_variant.c:1.13 
php-src/ext/com_dotnet/com_variant.c:1.14
--- php-src/ext/com_dotnet/com_variant.c:1.13   Sat Aug 13 15:03:58 2005
+++ php-src/ext/com_dotnet/com_variant.c        Sun Nov 27 07:21:12 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_variant.c,v 1.13 2005/08/13 19:03:58 wez Exp $ */
+/* $Id: com_variant.c,v 1.14 2005/11/27 12:21:12 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -217,7 +217,13 @@
                        break;
                case VT_BSTR:
                        if (V_BSTR(v)) {
-                               ZVAL_UNICODE(z, V_BSTR(v), 1);
+                               if (UG(unicode)) {
+                                       ZVAL_UNICODE(z, V_BSTR(v), 1);
+                               } else {
+                                       Z_TYPE_P(z) = IS_STRING;
+                                       Z_STRVAL_P(z) = 
php_com_olestring_to_string(V_BSTR(v),
+                                               &Z_STRLEN_P(z), codepage 
TSRMLS_CC);
+                               }
                        }
                        break;
                case VT_UNKNOWN:
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/php_com_dotnet_internal.h?r1=1.14&r2=1.15&ty=u
Index: php-src/ext/com_dotnet/php_com_dotnet_internal.h
diff -u php-src/ext/com_dotnet/php_com_dotnet_internal.h:1.14 
php-src/ext/com_dotnet/php_com_dotnet_internal.h:1.15
--- php-src/ext/com_dotnet/php_com_dotnet_internal.h:1.14       Wed Aug  3 
10:06:43 2005
+++ php-src/ext/com_dotnet/php_com_dotnet_internal.h    Sun Nov 27 07:21:12 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_com_dotnet_internal.h,v 1.14 2005/08/03 14:06:43 sniper Exp $ */
+/* $Id: php_com_dotnet_internal.h,v 1.15 2005/11/27 12:21:12 rrichards Exp $ */
 
 #ifndef PHP_COM_DOTNET_INTERNAL_H
 #define PHP_COM_DOTNET_INTERNAL_H
@@ -33,6 +33,8 @@
 #undef php_win_err
 
 typedef struct _php_com_dotnet_object {
+       zend_object zo;
+
        VARIANT v;
 
        ITypeInfo *typeinfo;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to