]> granicus.if.org Git - php/commitdiff
Fix problem when assigning to a variable that holds an instance of
authorWez Furlong <wez@php.net>
Mon, 3 May 2004 18:19:07 +0000 (18:19 +0000)
committerWez Furlong <wez@php.net>
Mon, 3 May 2004 18:19:07 +0000 (18:19 +0000)
a COM/VARIANT/DOTNET object.

ext/com_dotnet/com_handlers.c
ext/com_dotnet/com_saproxy.c
ext/com_dotnet/tests/variants.phpt

index 071f9df5f3c2c096b1a00ed2166da2bf7fd4951c..6e6003babd80f8c540374cee0604b2ce0605764a 100644 (file)
@@ -182,6 +182,7 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
        }
 }
 
+#if 0
 static void com_object_set(zval **property, zval *value TSRMLS_DC)
 {
        /* Not yet implemented in the engine */
@@ -192,6 +193,7 @@ static zval *com_object_get(zval *property TSRMLS_DC)
        /* 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 @@ zend_object_handlers php_com_object_handlers = {
        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_enable_event_sink(php_com_dotnet_object *obj, int enable TSR
 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;
index cf28d1e647c2df2b306467856f03ab5d6559b6ab..1187f51150848907c737b6c46bdeafeb8a50ad61 100644 (file)
@@ -244,6 +244,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM
        }
 }
 
+#if 0
 static void saproxy_object_set(zval **property, zval *value TSRMLS_DC)
 {
 }
@@ -253,6 +254,7 @@ static zval *saproxy_object_get(zval *property TSRMLS_DC)
        /* 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 int saproxy_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
 
 static union _zend_function *saproxy_constructor_get(zval *object TSRMLS_DC)
 {
-       /* user cannot instanciate */
+       /* user cannot instantiate */
        return NULL;
 }
 
@@ -328,8 +330,8 @@ zend_object_handlers php_com_saproxy_handlers = {
        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,
index 9fb1223a0432300ed337d6f52a5f076be50bb6a7..0fd27bee5ef63f5a8a61f658065db4302cc1e4f0 100644 (file)
@@ -19,14 +19,22 @@ $binary_ops = array('add', 'cat', 'sub', 'mul', 'and', 'div',
 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 @@ or: 46
 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 @@ or: 4
 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 @@ or: 4
 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