@@ -553,22 +553,23 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
553553 for (i = 0 , j = 0 ; i < nargs ; i ++ ) {
554554 /* if this was byref, update the zval */
555555 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 );
557560
558561 /* if the variant is pointing at the byref_vals, we need to map
559562 * the pointee value as a zval; otherwise, the value is pointing
560563 * into an existing PHP variant record */
561564 if (V_VT (& vargs [i ]) & VT_BYREF ) {
562565 if (vargs [i ].byref == & V_UINT (& byref_vals [j ])) {
563566 /* 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 );
566568 }
567569 } else {
568570 /* not sure if this can ever happen; the variant we marked as BYREF
569571 * 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 );
572573 }
573574 VariantClear (& byref_vals [j ]);
574575 j ++ ;
0 commit comments