wez             Wed Jul 28 19:48:26 2004 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/com_dotnet     com_extension.c com_handlers.c 
                                com_variant.c com_wrapper.c 
  Log:
  MFH:
  #29258: variant_date_from_timestamp() does not honour timezone
  #29392: com_dotnet crashes when echo'ing an object
  
  
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_extension.c?r1=1.14&r2=1.14.2.1&ty=u
Index: php-src/ext/com_dotnet/com_extension.c
diff -u php-src/ext/com_dotnet/com_extension.c:1.14 
php-src/ext/com_dotnet/com_extension.c:1.14.2.1
--- php-src/ext/com_dotnet/com_extension.c:1.14 Sun May  9 11:21:29 2004
+++ php-src/ext/com_dotnet/com_extension.c      Wed Jul 28 19:48:26 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_extension.c,v 1.14 2004/05/09 15:21:29 wez Exp $ */
+/* $Id: com_extension.c,v 1.14.2.1 2004/07/28 23:48:26 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -194,7 +194,7 @@
        INIT_CLASS_ENTRY(ce, "com_exception", NULL);
        php_com_exception_class_entry = zend_register_internal_class_ex(&ce, 
zend_exception_get_default(), NULL TSRMLS_CC);
        php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
-       php_com_exception_class_entry->constructor->common.fn_flags |= 
ZEND_ACC_PROTECTED;
+//     php_com_exception_class_entry->constructor->common.fn_flags |= 
ZEND_ACC_PROTECTED;
 
        INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL);
        php_com_saproxy_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_handlers.c?r1=1.22&r2=1.22.2.1&ty=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.22 
php-src/ext/com_dotnet/com_handlers.c:1.22.2.1
--- php-src/ext/com_dotnet/com_handlers.c:1.22  Tue May  4 11:03:48 2004
+++ php-src/ext/com_dotnet/com_handlers.c       Wed Jul 28 19:48:26 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_handlers.c,v 1.22 2004/05/04 15:03:48 wez Exp $ */
+/* $Id: com_handlers.c,v 1.22.2.1 2004/07/28 23:48:26 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -286,11 +286,19 @@
        }
 }
 
+static PHP_FUNCTION(com_method_handler)
+{
+       Z_OBJ_HANDLER_P(getThis(), call_method)(
+                       
((zend_internal_function*)EG(function_state_ptr)->function)->function_name,
+                       INTERNAL_FUNCTION_PARAM_PASSTHRU);
+}
+
 static union _zend_function *com_method_get(zval *object, char *name, int len 
TSRMLS_DC)
 {
        zend_internal_function f, *fptr = NULL;
        php_com_dotnet_object *obj;
        union _zend_function *func;
+       DISPID dummy;
 
        obj = CDNO_FETCH(object);
 
@@ -298,6 +306,10 @@
                return NULL;
        }
 
+       if (FAILED(php_com_get_id_of_name(obj, name, len, &dummy TSRMLS_CC))) {
+               return NULL;
+       }
+
        /* check cache */
        if (obj->method_cache == NULL || FAILURE == zend_hash_find(obj->method_cache, 
name, len, (void**)&fptr)) {
                f.type = ZEND_OVERLOADED_FUNCTION;
@@ -306,7 +318,10 @@
                f.scope = obj->ce;
                f.fn_flags = 0;
                f.function_name = estrndup(name, len);
+               f.handler = PHP_FN(com_method_handler);
 
+               fptr = &f;
+               
                if (obj->typeinfo) {
                        /* look for byref params */
                        ITypeComp *comp;
@@ -346,6 +361,9 @@
                                                case DESCKIND_TYPECOMP:
                                                        
ITypeComp_Release(bindptr.lptcomp);
                                                        break;
+
+                                               case DESCKIND_NONE:
+                                                       break;
                                        }
                                        if (TI) {
                                                ITypeInfo_Release(TI);
@@ -356,21 +374,27 @@
                        }
                }
 
-               /* save this method in the cache */
-               if (!obj->method_cache) {
-                       ALLOC_HASHTABLE(obj->method_cache);
-                       zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
-               }
+               if (fptr) {
+                       /* save this method in the cache */
+                       if (!obj->method_cache) {
+                               ALLOC_HASHTABLE(obj->method_cache);
+                               zend_hash_init(obj->method_cache, 2, NULL, 
function_dtor, 0);
+                       }
 
-               zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), 
(void**)&fptr);
+                       zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), 
(void**)&fptr);
+               }
        }
 
-       /* duplicate this into a new chunk of emalloc'd memory,
-        * since the engine will efree it */
-       func = emalloc(sizeof(*fptr));
-       memcpy(func, fptr, sizeof(*fptr));
+       if (fptr) {
+               /* duplicate this into a new chunk of emalloc'd memory,
+                * since the engine will efree it */
+               func = emalloc(sizeof(*fptr));
+               memcpy(func, fptr, sizeof(*fptr));
 
-       return func;
+               return func;
+       }
+
+       return NULL;
 }
 
 static int com_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_variant.c?r1=1.9&r2=1.9.2.1&ty=u
Index: php-src/ext/com_dotnet/com_variant.c
diff -u php-src/ext/com_dotnet/com_variant.c:1.9 
php-src/ext/com_dotnet/com_variant.c:1.9.2.1
--- php-src/ext/com_dotnet/com_variant.c:1.9    Wed Jun 16 19:57:25 2004
+++ php-src/ext/com_dotnet/com_variant.c        Wed Jul 28 19:48:26 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_variant.c,v 1.9 2004/06/16 23:57:25 abies Exp $ */
+/* $Id: com_variant.c,v 1.9.2.1 2004/07/28 23:48:26 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -799,7 +799,8 @@
        }
 
        VariantInit(&res);
-       tmv = gmtime(&timestamp);
+       tzset();
+       tmv = localtime(&timestamp);
        memset(&systime, 0, sizeof(systime));
 
        systime.wDay = tmv->tm_mday;
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_wrapper.c?r1=1.4&r2=1.4.2.1&ty=u
Index: php-src/ext/com_dotnet/com_wrapper.c
diff -u php-src/ext/com_dotnet/com_wrapper.c:1.4 
php-src/ext/com_dotnet/com_wrapper.c:1.4.2.1
--- php-src/ext/com_dotnet/com_wrapper.c:1.4    Mon May  3 11:51:41 2004
+++ php-src/ext/com_dotnet/com_wrapper.c        Wed Jul 28 19:48:26 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_wrapper.c,v 1.4 2004/05/03 15:51:41 wez Exp $ */
+/* $Id: com_wrapper.c,v 1.4.2.1 2004/07/28 23:48:26 wez Exp $ */
 
 /* This module exports a PHP object as a COM object by wrapping it
  * using IDispatchEx */
@@ -296,12 +296,16 @@
                } else if (wFlags & DISPATCH_PROPERTYPUT) {
                        zend_update_property(Z_OBJCE_P(disp->object), disp->object, 
Z_STRVAL_PP(name), Z_STRLEN_PP(name)+1, *params[0] TSRMLS_CC);
                } else if (wFlags & DISPATCH_METHOD) {
-                       if (SUCCESS == call_user_function_ex(EG(function_table), 
&disp->object, *name,
-                                       &retval, pdp->cArgs, params, 1, NULL 
TSRMLS_CC)) {
-                               ret = S_OK;
-                       } else {
+                       zend_try {
+                               if (SUCCESS == 
call_user_function_ex(EG(function_table), &disp->object, *name,
+                                                       &retval, pdp->cArgs, params, 
1, NULL TSRMLS_CC)) {
+                                       ret = S_OK;
+                               } else {
+                                       ret = DISP_E_EXCEPTION;
+                               }
+                       } zend_catch {
                                ret = DISP_E_EXCEPTION;
-                       }
+                       } zend_end_try();
                } else {
                        trace("Don't know how to handle this invocation %08x\n", 
wFlags);
                }

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

Reply via email to