wez             Mon May  3 14:19:07 2004 EDT

  Modified files:              
    /php-src/ext/com_dotnet     com_handlers.c com_saproxy.c 
    /php-src/ext/com_dotnet/tests       variants.phpt 
  Log:
  Fix problem when assigning to a variable that holds an instance of
  a COM/VARIANT/DOTNET object.
  
  
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_handlers.c?r1=1.19&r2=1.20&ty=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.19 
php-src/ext/com_dotnet/com_handlers.c:1.20
--- php-src/ext/com_dotnet/com_handlers.c:1.19  Wed Apr 28 04:23:22 2004
+++ php-src/ext/com_dotnet/com_handlers.c       Mon May  3 14:19:07 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_handlers.c,v 1.19 2004/04/28 08:23:22 wez Exp $ */
+/* $Id: com_handlers.c,v 1.20 2004/05/03 18:19:07 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -182,6 +182,7 @@
        }
 }
 
+#if 0
 static void com_object_set(zval **property, zval *value TSRMLS_DC)
 {
        /* Not yet implemented in the engine */
@@ -192,6 +193,7 @@
        /* Not yet implemented in the engine */
        return NULL;
 }
+#endif
 
 static int com_property_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
 {
@@ -518,8 +520,8 @@
        com_read_dimension,
        com_write_dimension,
        NULL,
-       com_object_get,
-       com_object_set,
+       NULL, //com_object_get,
+       NULL, //com_object_set,
        com_property_exists,
        com_property_delete,
        com_dimension_exists,
@@ -561,6 +563,7 @@
 void php_com_object_free_storage(void *object TSRMLS_DC)
 {
        php_com_dotnet_object *obj = (php_com_dotnet_object*)object;
+
        if (obj->typeinfo) {
                ITypeInfo_Release(obj->typeinfo);
                obj->typeinfo = NULL;
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_saproxy.c?r1=1.9&r2=1.10&ty=u
Index: php-src/ext/com_dotnet/com_saproxy.c
diff -u php-src/ext/com_dotnet/com_saproxy.c:1.9 
php-src/ext/com_dotnet/com_saproxy.c:1.10
--- php-src/ext/com_dotnet/com_saproxy.c:1.9    Wed Apr 28 04:23:22 2004
+++ php-src/ext/com_dotnet/com_saproxy.c        Mon May  3 14:19:07 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_saproxy.c,v 1.9 2004/04/28 08:23:22 wez Exp $ */
+/* $Id: com_saproxy.c,v 1.10 2004/05/03 18:19:07 wez Exp $ */
 
 /* This module implements a SafeArray proxy which is used internally
  * by the engine when resolving multi-dimensional array accesses on
@@ -244,6 +244,7 @@
        }
 }
 
+#if 0
 static void saproxy_object_set(zval **property, zval *value TSRMLS_DC)
 {
 }
@@ -253,6 +254,7 @@
        /* Not yet implemented in the engine */
        return NULL;
 }
+#endif
 
 static int saproxy_property_exists(zval *object, zval *member, int check_empty 
TSRMLS_DC)
 {
@@ -295,7 +297,7 @@
 
 static union _zend_function *saproxy_constructor_get(zval *object TSRMLS_DC)
 {
-       /* user cannot instanciate */
+       /* user cannot instantiate */
        return NULL;
 }
 
@@ -328,8 +330,8 @@
        saproxy_read_dimension,
        saproxy_write_dimension,
        NULL,
-       saproxy_object_get,
-       saproxy_object_set,
+       NULL, //saproxy_object_get,
+       NULL, //saproxy_object_set,
        saproxy_property_exists,
        saproxy_property_delete,
        saproxy_dimension_exists,
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/tests/variants.phpt?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/com_dotnet/tests/variants.phpt
diff -u php-src/ext/com_dotnet/tests/variants.phpt:1.2 
php-src/ext/com_dotnet/tests/variants.phpt:1.3
--- php-src/ext/com_dotnet/tests/variants.phpt:1.2      Fri Dec  5 08:42:02 2003
+++ php-src/ext/com_dotnet/tests/variants.phpt  Mon May  3 14:19:07 2004
@@ -4,7 +4,7 @@
 <?php # vim:ft=php
 if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
 --FILE--
-<?php // $Id: variants.phpt,v 1.2 2003/12/05 13:42:02 wez Exp $
+<?php // $Id: variants.phpt,v 1.3 2004/05/03 18:19:07 wez Exp $
 error_reporting(E_ALL);
 
 $v = new VARIANT();
@@ -19,14 +19,22 @@
 foreach ($values as $t => $val) {
        $v = new VARIANT($val);
        if ($t != variant_get_type($v)) {
-               printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), (string)$v);
+               printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val);
+               print $v . "\n";
        }
        $results = array();
 
        foreach ($values as $op2) {
                echo "--\n";
                foreach ($binary_ops as $op) {
-                       echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . 
"\n";
+                       try {
+                               echo "$op: " . call_user_func('variant_' . $op, $v, 
$op2) . "\n";
+                       } catch (com_exception $e) {
+                               echo "$op:\n";
+                               echo "\tvariant_$op($v, $op2)\n";
+                               echo "\texception " . $e->getMessage();
+                               printf("\tcode %08x\n\n", $e->getCode());
+                       }
                }
        }
 }
@@ -63,30 +71,90 @@
 pow: 480145.116863642
 xor: 46
 --
-add: 
+add:
+       variant_add(42, hello)
+       exception Type mismatch.
+       code 80020005
+
 cat: 42hello
-sub: 
-mul: 
-and: 
-div: 
-eqv: 
-idiv: 
-imp: 
-mod: 
-or: 
-pow: 
-xor: 
+sub:
+       variant_sub(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+mul:
+       variant_mul(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+and:
+       variant_and(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+div:
+       variant_div(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+eqv:
+       variant_eqv(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+idiv:
+       variant_idiv(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+imp:
+       variant_imp(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+mod:
+       variant_mod(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+or:
+       variant_or(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+pow:
+       variant_pow(42, hello)
+       exception Type mismatch.
+       code 80020005
+
+xor:
+       variant_xor(42, hello)
+       exception Type mismatch.
+       code 80020005
+
 --
 add: 42
 cat: 42False
 sub: 42
 mul: 0
 and: 0
-div: 
+div:
+       variant_div(42, )
+       exception Division by zero.
+       code 80020012
+
 eqv: -43
-idiv: 
+idiv:
+       variant_idiv(42, )
+       exception Division by zero.
+       code 80020012
+
 imp: -43
-mod: 
+mod:
+       variant_mod(42, )
+       exception Division by zero.
+       code 80020012
+
 or: 42
 pow: 1
 xor: 42
@@ -119,89 +187,337 @@
 pow: 80.2117802289664
 xor: 0
 --
-add: 
+add:
+       variant_add(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
 cat: 3.5hello
-sub: 
-mul: 
-and: 
-div: 
-eqv: 
-idiv: 
-imp: 
-mod: 
-or: 
-pow: 
-xor: 
+sub:
+       variant_sub(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+mul:
+       variant_mul(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+and:
+       variant_and(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+div:
+       variant_div(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+eqv:
+       variant_eqv(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+idiv:
+       variant_idiv(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+imp:
+       variant_imp(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+mod:
+       variant_mod(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+or:
+       variant_or(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+pow:
+       variant_pow(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
+xor:
+       variant_xor(3.5, hello)
+       exception Type mismatch.
+       code 80020005
+
 --
 add: 3.5
 cat: 3.5False
 sub: 3.5
 mul: 0
 and: 0
-div: 
+div:
+       variant_div(3.5, )
+       exception Division by zero.
+       code 80020012
+
 eqv: -5
-idiv: 
+idiv:
+       variant_idiv(3.5, )
+       exception Division by zero.
+       code 80020012
+
 imp: -5
-mod: 
+mod:
+       variant_mod(3.5, )
+       exception Division by zero.
+       code 80020012
+
 or: 4
 pow: 1
 xor: 4
 --
-add: 
+add:
+       variant_add(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
 cat: hello42
-sub: 
-mul: 
-and: 
-div: 
-eqv: 
-idiv: 
-imp: 
-mod: 
-or: 
-pow: 
-xor: 
+sub:
+       variant_sub(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+mul:
+       variant_mul(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+and:
+       variant_and(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+div:
+       variant_div(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+eqv:
+       variant_eqv(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+idiv:
+       variant_idiv(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+imp:
+       variant_imp(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+mod:
+       variant_mod(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+or:
+       variant_or(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+pow:
+       variant_pow(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
+xor:
+       variant_xor(hello, 42)
+       exception Type mismatch.
+       code 80020005
+
 --
-add: 
+add:
+       variant_add(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
 cat: hello3.5
-sub: 
-mul: 
-and: 
-div: 
-eqv: 
-idiv: 
-imp: 
-mod: 
-or: 
-pow: 
-xor: 
+sub:
+       variant_sub(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+mul:
+       variant_mul(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+and:
+       variant_and(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+div:
+       variant_div(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+eqv:
+       variant_eqv(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+idiv:
+       variant_idiv(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+imp:
+       variant_imp(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+mod:
+       variant_mod(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+or:
+       variant_or(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+pow:
+       variant_pow(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
+xor:
+       variant_xor(hello, 3.5)
+       exception Type mismatch.
+       code 80020005
+
 --
 add: hellohello
 cat: hellohello
-sub: 
-mul: 
-and: 
-div: 
-eqv: 
-idiv: 
-imp: 
-mod: 
-or: 
-pow: 
-xor: 
+sub:
+       variant_sub(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+mul:
+       variant_mul(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+and:
+       variant_and(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+div:
+       variant_div(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+eqv:
+       variant_eqv(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+idiv:
+       variant_idiv(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+imp:
+       variant_imp(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+mod:
+       variant_mod(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+or:
+       variant_or(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+pow:
+       variant_pow(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
+xor:
+       variant_xor(hello, hello)
+       exception Type mismatch.
+       code 80020005
+
 --
-add: 
+add:
+       variant_add(hello, )
+       exception Type mismatch.
+       code 80020005
+
 cat: helloFalse
-sub: 
-mul: 
-and: 
-div: 
-eqv: 
-idiv: 
-imp: 
-mod: 
-or: 
-pow: 
-xor: 
+sub:
+       variant_sub(hello, )
+       exception Type mismatch.
+       code 80020005
+
+mul:
+       variant_mul(hello, )
+       exception Type mismatch.
+       code 80020005
+
+and:
+       variant_and(hello, )
+       exception Type mismatch.
+       code 80020005
+
+div:
+       variant_div(hello, )
+       exception Type mismatch.
+       code 80020005
+
+eqv:
+       variant_eqv(hello, )
+       exception Type mismatch.
+       code 80020005
+
+idiv:
+       variant_idiv(hello, )
+       exception Type mismatch.
+       code 80020005
+
+imp:
+       variant_imp(hello, )
+       exception Type mismatch.
+       code 80020005
+
+mod:
+       variant_mod(hello, )
+       exception Type mismatch.
+       code 80020005
+
+or:
+       variant_or(hello, )
+       exception Type mismatch.
+       code 80020005
+
+pow:
+       variant_pow(hello, )
+       exception Type mismatch.
+       code 80020005
+
+xor:
+       variant_xor(hello, )
+       exception Type mismatch.
+       code 80020005
+
 --
 add: 42
 cat: False42
@@ -231,30 +547,90 @@
 pow: 0
 xor: 4
 --
-add: 
+add:
+       variant_add(0, hello)
+       exception Type mismatch.
+       code 80020005
+
 cat: Falsehello
-sub: 
-mul: 
-and: 
-div: 
-eqv: 
-idiv: 
-imp: 
-mod: 
-or: 
-pow: 
-xor: 
+sub:
+       variant_sub(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+mul:
+       variant_mul(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+and:
+       variant_and(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+div:
+       variant_div(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+eqv:
+       variant_eqv(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+idiv:
+       variant_idiv(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+imp:
+       variant_imp(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+mod:
+       variant_mod(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+or:
+       variant_or(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+pow:
+       variant_pow(0, hello)
+       exception Type mismatch.
+       code 80020005
+
+xor:
+       variant_xor(0, hello)
+       exception Type mismatch.
+       code 80020005
+
 --
 add: 0
 cat: FalseFalse
 sub: 0
 mul: 0
 and: 0
-div: 
+div:
+       variant_div(0, )
+       exception Out of present range.
+       code 8002000a
+
 eqv: -1
-idiv: 
+idiv:
+       variant_idiv(0, )
+       exception Division by zero.
+       code 80020012
+
 imp: -1
-mod: 
+mod:
+       variant_mod(0, )
+       exception Division by zero.
+       code 80020012
+
 or: 0
 pow: 1
 xor: 0

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

Reply via email to