27
27
#include "php_com_dotnet_internal.h"
28
28
#include "Zend/zend_exceptions.h"
29
29
30
- static zval * com_property_read (zval * object , zval * member , int type , void * * cahce_slot , zval * rv )
30
+ static zval * com_property_read (zend_object * object , zend_string * member , int type , void * * cahce_slot , zval * rv )
31
31
{
32
32
php_com_dotnet_object * obj ;
33
33
VARIANT v ;
34
34
HRESULT res ;
35
35
36
36
ZVAL_NULL (rv );
37
37
38
- obj = CDNO_FETCH ( object ) ;
38
+ obj = ( php_com_dotnet_object * ) object ;
39
39
40
40
if (V_VT (& obj -> v ) == VT_DISPATCH ) {
41
41
VariantInit (& v );
42
42
43
- convert_to_string_ex (member );
44
-
45
- res = php_com_do_invoke (obj , Z_STRVAL_P (member ), Z_STRLEN_P (member ),
43
+ res = php_com_do_invoke (obj , ZSTR_VAL (member ), ZSTR_LEN (member ),
46
44
DISPATCH_METHOD |DISPATCH_PROPERTYGET , & v , 0 , NULL , 1 );
47
45
48
46
if (res == SUCCESS ) {
49
47
php_com_zval_from_variant (rv , & v , obj -> code_page );
50
48
VariantClear (& v );
51
49
} else if (res == DISP_E_BADPARAMCOUNT ) {
52
- php_com_saproxy_create (object , rv , member );
50
+ zval zv ;
51
+
52
+ ZVAL_STR (& zv , member );
53
+ php_com_saproxy_create (object , rv , & zv );
53
54
}
54
55
} else {
55
56
php_com_throw_exception (E_INVALIDARG , "this variant has no properties" );
@@ -58,18 +59,17 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
58
59
return rv ;
59
60
}
60
61
61
- static zval * com_property_write (zval * object , zval * member , zval * value , void * * cache_slot )
62
+ static zval * com_property_write (zend_object * object , zend_string * member , zval * value , void * * cache_slot )
62
63
{
63
64
php_com_dotnet_object * obj ;
64
65
VARIANT v ;
65
66
66
- obj = CDNO_FETCH ( object ) ;
67
+ obj = ( php_com_dotnet_object * ) object ;
67
68
68
69
if (V_VT (& obj -> v ) == VT_DISPATCH ) {
69
70
VariantInit (& v );
70
71
71
- convert_to_string_ex (member );
72
- if (SUCCESS == php_com_do_invoke (obj , Z_STRVAL_P (member ), Z_STRLEN_P (member ),
72
+ if (SUCCESS == php_com_do_invoke (obj , ZSTR_VAL (member ), ZSTR_LEN (member ),
73
73
DISPATCH_PROPERTYPUT |DISPATCH_PROPERTYPUTREF , & v , 1 , value , 0 )) {
74
74
VariantClear (& v );
75
75
}
@@ -79,14 +79,14 @@ static zval *com_property_write(zval *object, zval *member, zval *value, void **
79
79
return value ;
80
80
}
81
81
82
- static zval * com_read_dimension (zval * object , zval * offset , int type , zval * rv )
82
+ static zval * com_read_dimension (zend_object * object , zval * offset , int type , zval * rv )
83
83
{
84
84
php_com_dotnet_object * obj ;
85
85
VARIANT v ;
86
86
87
87
ZVAL_NULL (rv );
88
88
89
- obj = CDNO_FETCH ( object ) ;
89
+ obj = ( php_com_dotnet_object * ) object ;
90
90
91
91
if (V_VT (& obj -> v ) == VT_DISPATCH ) {
92
92
VariantInit (& v );
@@ -115,14 +115,14 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv)
115
115
return rv ;
116
116
}
117
117
118
- static void com_write_dimension (zval * object , zval * offset , zval * value )
118
+ static void com_write_dimension (zend_object * object , zval * offset , zval * value )
119
119
{
120
120
php_com_dotnet_object * obj ;
121
121
zval args [2 ];
122
122
VARIANT v ;
123
123
HRESULT res ;
124
124
125
- obj = CDNO_FETCH ( object ) ;
125
+ obj = ( php_com_dotnet_object * ) object ;
126
126
127
127
if (V_VT (& obj -> v ) == VT_DISPATCH ) {
128
128
ZVAL_COPY_VALUE (& args [0 ], offset );
@@ -187,16 +187,15 @@ static zval *com_object_get(zval *property)
187
187
}
188
188
#endif
189
189
190
- static int com_property_exists (zval * object , zval * member , int check_empty , void * * cache_slot )
190
+ static int com_property_exists (zend_object * object , zend_string * member , int check_empty , void * * cache_slot )
191
191
{
192
192
DISPID dispid ;
193
193
php_com_dotnet_object * obj ;
194
194
195
- obj = CDNO_FETCH ( object ) ;
195
+ obj = ( php_com_dotnet_object * ) object ;
196
196
197
197
if (V_VT (& obj -> v ) == VT_DISPATCH ) {
198
- convert_to_string_ex (member );
199
- if (SUCCEEDED (php_com_get_id_of_name (obj , Z_STRVAL_P (member ), Z_STRLEN_P (member ), & dispid ))) {
198
+ if (SUCCEEDED (php_com_get_id_of_name (obj , ZSTR_VAL (member ), ZSTR_LEN (member ), & dispid ))) {
200
199
/* TODO: distinguish between property and method! */
201
200
return 1 ;
202
201
}
@@ -207,23 +206,23 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void
207
206
return 0 ;
208
207
}
209
208
210
- static int com_dimension_exists (zval * object , zval * member , int check_empty )
209
+ static int com_dimension_exists (zend_object * object , zval * member , int check_empty )
211
210
{
212
211
php_error_docref (NULL , E_WARNING , "Operation not yet supported on a COM object" );
213
212
return 0 ;
214
213
}
215
214
216
- static void com_property_delete (zval * object , zval * member , void * * cache_slot )
215
+ static void com_property_delete (zend_object * object , zend_string * member , void * * cache_slot )
217
216
{
218
217
php_error_docref (NULL , E_WARNING , "Cannot delete properties from a COM object" );
219
218
}
220
219
221
- static void com_dimension_delete (zval * object , zval * offset )
220
+ static void com_dimension_delete (zend_object * object , zval * offset )
222
221
{
223
222
php_error_docref (NULL , E_WARNING , "Cannot delete properties from a COM object" );
224
223
}
225
224
226
- static HashTable * com_properties_get (zval * object )
225
+ static HashTable * com_properties_get (zend_object * object )
227
226
{
228
227
/* TODO: use type-info to get all the names and values ?
229
228
* DANGER: if we do that, there is a strong possibility for
@@ -468,7 +467,7 @@ static int com_object_cast(zend_object *readobj, zval *writeobj, int type)
468
467
VARTYPE vt = VT_EMPTY ;
469
468
HRESULT res = S_OK ;
470
469
471
- obj = CDNO_FETCH ( readobj ) ;
470
+ obj = ( php_com_dotnet_object * ) readobj ;
472
471
ZVAL_NULL (writeobj );
473
472
VariantInit (& v );
474
473
@@ -518,12 +517,12 @@ static int com_object_cast(zend_object *readobj, zval *writeobj, int type)
518
517
return zend_std_cast_object_tostring (readobj , writeobj , type );
519
518
}
520
519
521
- static int com_object_count (zval * object , zend_long * count )
520
+ static int com_object_count (zend_object * object , zend_long * count )
522
521
{
523
522
php_com_dotnet_object * obj ;
524
523
LONG ubound = 0 , lbound = 0 ;
525
524
526
- obj = CDNO_FETCH ( object ) ;
525
+ obj = ( php_com_dotnet_object * ) object ;
527
526
528
527
if (!V_ISARRAY (& obj -> v )) {
529
528
return FAILURE ;
@@ -617,11 +616,11 @@ void php_com_object_free_storage(zend_object *object)
617
616
}
618
617
}
619
618
620
- zend_object * php_com_object_clone (zval * object )
619
+ zend_object * php_com_object_clone (zend_object * object )
621
620
{
622
621
php_com_dotnet_object * cloneobj , * origobject ;
623
622
624
- origobject = (php_com_dotnet_object * )Z_OBJ_P ( object ) ;
623
+ origobject = (php_com_dotnet_object * ) object ;
625
624
cloneobj = (php_com_dotnet_object * )emalloc (sizeof (php_com_dotnet_object ));
626
625
627
626
memcpy (cloneobj , origobject , sizeof (* cloneobj ));
0 commit comments