Skip to content

Commit 36f2c82

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: update NEWS Fixed bug #72922 COM called from PHP does not return out parameters
2 parents aefd3e4 + cd5cab6 commit 36f2c82

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ext/com_dotnet/com_com.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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++;

ext/com_dotnet/com_handlers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ static union _zend_function *com_method_get(zend_object **object_ptr, zend_strin
305305
for (i = 0; i < bindptr.lpfuncdesc->cParams; i++) {
306306
f.arg_info[i].allow_null = 1;
307307
if (bindptr.lpfuncdesc->lprgelemdescParam[i].paramdesc.wParamFlags & PARAMFLAG_FOUT) {
308-
f.arg_info[i].pass_by_reference = 1;
308+
f.arg_info[i].pass_by_reference = ZEND_SEND_BY_REF;
309+
ZEND_SET_ARG_FLAG(fptr, i + 1, ZEND_SEND_BY_REF);
309310
}
310311
}
311312

0 commit comments

Comments
 (0)