@@ -553,22 +553,23 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
553
553
for (i = 0 , j = 0 ; i < nargs ; i ++ ) {
554
554
/* if this was byref, update the zval */
555
555
if (f -> arg_info [nargs - i - 1 ].pass_by_reference ) {
556
- SEPARATE_ZVAL_IF_NOT_REF (& args [nargs - i - 1 ]);
556
+ zval * arg = & args [nargs - i - 1 ];
557
+
558
+ ZVAL_DEREF (arg );
559
+ SEPARATE_ZVAL_NOREF (arg );
557
560
558
561
/* if the variant is pointing at the byref_vals, we need to map
559
562
* the pointee value as a zval; otherwise, the value is pointing
560
563
* into an existing PHP variant record */
561
564
if (V_VT (& vargs [i ]) & VT_BYREF ) {
562
565
if (vargs [i ].byref == & V_UINT (& byref_vals [j ])) {
563
566
/* copy that value */
564
- php_com_zval_from_variant (& args [nargs - i - 1 ], & byref_vals [j ],
565
- obj -> code_page );
567
+ php_com_zval_from_variant (arg , & byref_vals [j ], obj -> code_page );
566
568
}
567
569
} else {
568
570
/* not sure if this can ever happen; the variant we marked as BYREF
569
571
* is no longer BYREF - copy its value */
570
- php_com_zval_from_variant (& args [nargs - i - 1 ], & vargs [i ],
571
- obj -> code_page );
572
+ php_com_zval_from_variant (arg , & vargs [i ], obj -> code_page );
572
573
}
573
574
VariantClear (& byref_vals [j ]);
574
575
j ++ ;
0 commit comments