Skip to content

Commit 377ac2a

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79247: Garbage collecting variant objects segfaults
2 parents 538c088 + b4f61d9 commit 377ac2a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

ext/com_dotnet/bug79247.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #79247 (Garbage collecting variant objects segfaults)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$keep = new variant(null);
10+
var_dump(gc_collect_cycles());
11+
?>
12+
--EXPECT--
13+
int(0)

ext/com_dotnet/com_handlers.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ static HashTable *com_properties_get(zend_object *object)
227227
return &zend_empty_array;
228228
}
229229

230+
static HashTable *com_get_gc(zval *object, zval **table, int *n)
231+
{
232+
*table = NULL;
233+
*n = 0;
234+
return NULL;
235+
}
236+
230237
static void function_dtor(zval *zv)
231238
{
232239
zend_internal_function *f = (zend_internal_function*)Z_PTR_P(zv);
@@ -552,7 +559,7 @@ zend_object_handlers php_com_object_handlers = {
552559
com_object_count,
553560
NULL, /* get_debug_info */
554561
NULL, /* get_closure */
555-
zend_std_get_gc, /* get_gc */
562+
com_get_gc, /* get_gc */
556563
NULL, /* do_operation */
557564
com_objects_compare, /* compare */
558565
NULL, /* get_properties_for */

0 commit comments

Comments
 (0)