Skip to content

Commit fc4a6cd

Browse files
committed
Merge branch 'PHP-7.4' into master
* PHP-7.4: Fix #64130: COM obj parameters passed by reference are not updated
2 parents 1b2ec73 + 1ff981d commit fc4a6cd

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

ext/com_dotnet/com_com.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,9 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
436436
if (obj->typeinfo) {
437437
hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);
438438
if (FAILED(hr)) {
439+
HRESULT hr1 = hr;
439440
hr = IDispatch_GetIDsOfNames(V_DISPATCH(&obj->v), &IID_NULL, &olename, 1, LOCALE_SYSTEM_DEFAULT, dispid);
440-
if (SUCCEEDED(hr)) {
441+
if (SUCCEEDED(hr) && hr1 != E_NOTIMPL) {
441442
/* fall back on IDispatch direct */
442443
ITypeInfo_Release(obj->typeinfo);
443444
obj->typeinfo = NULL;
@@ -584,6 +585,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
584585
}
585586
}
586587
efree(vargs);
588+
if (byref_vals) efree(byref_vals);
587589
}
588590

589591
return SUCCEEDED(hr) ? SUCCESS : FAILURE;

ext/com_dotnet/tests/bug64130.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #64130 (COM obj parameters passed by reference are not updated)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
6+
if (PHP_INT_SIZE != 4) die('skip for 32bit platforms only');
7+
try {
8+
$ie = new com('InternetExplorer.Application');
9+
} catch (com_exception $ex) {
10+
die("skip {$ex->getMessage()}");
11+
}
12+
$ie->quit();
13+
?>
14+
--FILE--
15+
<?php
16+
$ie = new com('InternetExplorer.Application');
17+
$x = 0;
18+
$y = 0;
19+
try {
20+
$ie->clientToWindow($x, $y);
21+
} catch (com_exception $ex) {}
22+
var_dump($x > 0, $y > 0);
23+
$ie->quit();
24+
?>
25+
--EXPECT--
26+
bool(true)
27+
bool(true)

0 commit comments

Comments
 (0)