Skip to content

Commit 38a2899

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-16991: Getting typeinfo of non DISPATCH variant segfaults
2 parents e8154c6 + 8ea042d commit 38a2899

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ext/com_dotnet/com_typeinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ ITypeInfo *php_com_locate_typeinfo(zend_string *type_lib_name, php_com_dotnet_ob
331331
if (obj->typeinfo) {
332332
ITypeInfo_AddRef(obj->typeinfo);
333333
return obj->typeinfo;
334-
} else {
334+
} else if (V_VT(&obj->v) == VT_DISPATCH) {
335335
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
336336
if (typeinfo) {
337337
return typeinfo;

ext/com_dotnet/tests/gh16991.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
GH-16991 (Getting typeinfo of non DISPATCH variant segfaults)
3+
--EXTENSIONS--
4+
com_dotnet
5+
--FILE--
6+
<?php
7+
com_print_typeinfo(new variant("hello"));
8+
?>
9+
--EXPECTF--
10+
Warning: com_print_typeinfo(): Unable to find typeinfo using the parameters supplied in %s on line %d

0 commit comments

Comments
 (0)