2727#include "php_com_dotnet_internal.h"
2828#include "Zend/zend_exceptions.h"
2929
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 )
3131{
3232 php_com_dotnet_object * obj ;
3333 VARIANT v ;
3434 HRESULT res ;
3535
3636 ZVAL_NULL (rv );
3737
38- obj = CDNO_FETCH ( object ) ;
38+ obj = ( php_com_dotnet_object * ) object ;
3939
4040 if (V_VT (& obj -> v ) == VT_DISPATCH ) {
4141 VariantInit (& v );
4242
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 ),
4644 DISPATCH_METHOD |DISPATCH_PROPERTYGET , & v , 0 , NULL , 1 );
4745
4846 if (res == SUCCESS ) {
4947 php_com_zval_from_variant (rv , & v , obj -> code_page );
5048 VariantClear (& v );
5149 } 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 );
5354 }
5455 } else {
5556 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
5859 return rv ;
5960}
6061
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 )
6263{
6364 php_com_dotnet_object * obj ;
6465 VARIANT v ;
6566
66- obj = CDNO_FETCH ( object ) ;
67+ obj = ( php_com_dotnet_object * ) object ;
6768
6869 if (V_VT (& obj -> v ) == VT_DISPATCH ) {
6970 VariantInit (& v );
7071
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 ),
7373 DISPATCH_PROPERTYPUT |DISPATCH_PROPERTYPUTREF , & v , 1 , value , 0 )) {
7474 VariantClear (& v );
7575 }
@@ -79,14 +79,14 @@ static zval *com_property_write(zval *object, zval *member, zval *value, void **
7979 return value ;
8080}
8181
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 )
8383{
8484 php_com_dotnet_object * obj ;
8585 VARIANT v ;
8686
8787 ZVAL_NULL (rv );
8888
89- obj = CDNO_FETCH ( object ) ;
89+ obj = ( php_com_dotnet_object * ) object ;
9090
9191 if (V_VT (& obj -> v ) == VT_DISPATCH ) {
9292 VariantInit (& v );
@@ -115,14 +115,14 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv)
115115 return rv ;
116116}
117117
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 )
119119{
120120 php_com_dotnet_object * obj ;
121121 zval args [2 ];
122122 VARIANT v ;
123123 HRESULT res ;
124124
125- obj = CDNO_FETCH ( object ) ;
125+ obj = ( php_com_dotnet_object * ) object ;
126126
127127 if (V_VT (& obj -> v ) == VT_DISPATCH ) {
128128 ZVAL_COPY_VALUE (& args [0 ], offset );
@@ -187,16 +187,15 @@ static zval *com_object_get(zval *property)
187187}
188188#endif
189189
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 )
191191{
192192 DISPID dispid ;
193193 php_com_dotnet_object * obj ;
194194
195- obj = CDNO_FETCH ( object ) ;
195+ obj = ( php_com_dotnet_object * ) object ;
196196
197197 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 ))) {
200199 /* TODO: distinguish between property and method! */
201200 return 1 ;
202201 }
@@ -207,23 +206,23 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void
207206 return 0 ;
208207}
209208
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 )
211210{
212211 php_error_docref (NULL , E_WARNING , "Operation not yet supported on a COM object" );
213212 return 0 ;
214213}
215214
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 )
217216{
218217 php_error_docref (NULL , E_WARNING , "Cannot delete properties from a COM object" );
219218}
220219
221- static void com_dimension_delete (zval * object , zval * offset )
220+ static void com_dimension_delete (zend_object * object , zval * offset )
222221{
223222 php_error_docref (NULL , E_WARNING , "Cannot delete properties from a COM object" );
224223}
225224
226- static HashTable * com_properties_get (zval * object )
225+ static HashTable * com_properties_get (zend_object * object )
227226{
228227 /* TODO: use type-info to get all the names and values ?
229228 * 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)
468467 VARTYPE vt = VT_EMPTY ;
469468 HRESULT res = S_OK ;
470469
471- obj = CDNO_FETCH ( readobj ) ;
470+ obj = ( php_com_dotnet_object * ) readobj ;
472471 ZVAL_NULL (writeobj );
473472 VariantInit (& v );
474473
@@ -518,12 +517,12 @@ static int com_object_cast(zend_object *readobj, zval *writeobj, int type)
518517 return zend_std_cast_object_tostring (readobj , writeobj , type );
519518}
520519
521- static int com_object_count (zval * object , zend_long * count )
520+ static int com_object_count (zend_object * object , zend_long * count )
522521{
523522 php_com_dotnet_object * obj ;
524523 LONG ubound = 0 , lbound = 0 ;
525524
526- obj = CDNO_FETCH ( object ) ;
525+ obj = ( php_com_dotnet_object * ) object ;
527526
528527 if (!V_ISARRAY (& obj -> v )) {
529528 return FAILURE ;
@@ -617,11 +616,11 @@ void php_com_object_free_storage(zend_object *object)
617616 }
618617}
619618
620- zend_object * php_com_object_clone (zval * object )
619+ zend_object * php_com_object_clone (zend_object * object )
621620{
622621 php_com_dotnet_object * cloneobj , * origobject ;
623622
624- origobject = (php_com_dotnet_object * )Z_OBJ_P ( object ) ;
623+ origobject = (php_com_dotnet_object * ) object ;
625624 cloneobj = (php_com_dotnet_object * )emalloc (sizeof (php_com_dotnet_object ));
626625
627626 memcpy (cloneobj , origobject , sizeof (* cloneobj ));
0 commit comments