summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-23 23:35:33 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-23 23:35:33 +0100
commit6c7306f45df6c558ec55a2d12e343a78a0ceee53 (patch)
tree37862fe113c9f1d4419141a7c098425e3344444f
parent736b1ab200d695bf1988bc7690e3e86879db4463 (diff)
parent09e7c86779b281c3d1fbff5954fbb9e0b052cf33 (diff)
downloadphp-git-6c7306f45df6c558ec55a2d12e343a78a0ceee53.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79299: com_print_typeinfo prints duplicate variables
-rw-r--r--ext/com_dotnet/com_typeinfo.c2
-rw-r--r--ext/com_dotnet/tests/bug79299.phpt20
2 files changed, 21 insertions, 1 deletions
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index fe1d18f5d6..0c8ed5ad79 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -478,6 +478,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
char *ansiname = NULL;
size_t ansinamelen;
int ret = 0;
+ DISPID lastid = 0; /* for props */
if (FAILED(ITypeInfo_GetTypeAttr(typeinfo, &attr))) {
return 0;
@@ -511,7 +512,6 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
/* So we've got the dispatch interface; lets list the event methods */
for (i = 0; i < attr->cFuncs; i++) {
zval tmp;
- DISPID lastid = 0; /* for props */
int isprop;
if (FAILED(ITypeInfo_GetFuncDesc(typeinfo, i, &func)))
diff --git a/ext/com_dotnet/tests/bug79299.phpt b/ext/com_dotnet/tests/bug79299.phpt
new file mode 100644
index 0000000000..99c1a99742
--- /dev/null
+++ b/ext/com_dotnet/tests/bug79299.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #79299 (com_print_typeinfo prints duplicate variables)
+--SKIPIF--
+<?php
+if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
+?>
+--FILE--
+<?php
+$dict = new COM("Scripting.Dictionary");
+ob_start();
+com_print_typeinfo($dict);
+$typeinfo = ob_get_clean();
+preg_match_all('/\/\* DISPID=9 \*\//', $typeinfo, $matches);
+var_dump($matches[0]);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ string(14) "/* DISPID=9 */"
+} \ No newline at end of file