Skip to content

Commit 6c7306f

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79299: com_print_typeinfo prints duplicate variables
2 parents 736b1ab + 09e7c86 commit 6c7306f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

ext/com_dotnet/com_typeinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
478478
char *ansiname = NULL;
479479
size_t ansinamelen;
480480
int ret = 0;
481+
DISPID lastid = 0; /* for props */
481482

482483
if (FAILED(ITypeInfo_GetTypeAttr(typeinfo, &attr))) {
483484
return 0;
@@ -511,7 +512,6 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
511512
/* So we've got the dispatch interface; lets list the event methods */
512513
for (i = 0; i < attr->cFuncs; i++) {
513514
zval tmp;
514-
DISPID lastid = 0; /* for props */
515515
int isprop;
516516

517517
if (FAILED(ITypeInfo_GetFuncDesc(typeinfo, i, &func)))

ext/com_dotnet/tests/bug79299.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #79299 (com_print_typeinfo prints duplicate variables)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$dict = new COM("Scripting.Dictionary");
10+
ob_start();
11+
com_print_typeinfo($dict);
12+
$typeinfo = ob_get_clean();
13+
preg_match_all('/\/\* DISPID=9 \*\//', $typeinfo, $matches);
14+
var_dump($matches[0]);
15+
?>
16+
--EXPECT--
17+
array(1) {
18+
[0]=>
19+
string(14) "/* DISPID=9 */"
20+
}

0 commit comments

Comments
 (0)