Skip to content

Commit 9c619a8

Browse files
committed
wip
1 parent 5ddb756 commit 9c619a8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,23 @@ static zend_function *dbstmt_method_get(zend_object **object_pp, zend_string *me
20772077
return fbc;
20782078
}
20792079

2080+
static HashTable *dbstmt_get_gc(zend_object *object, zval **gc_data, int *gc_count)
2081+
{
2082+
pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
2083+
*gc_data = &stmt->fetch.into;
2084+
*gc_count = 1;
2085+
2086+
/**
2087+
* If there are no dynamic properties and the default property is 1 (that is, there is only one property
2088+
* of string that does not participate in GC), there is no need to call zend_std_get_properties().
2089+
*/
2090+
if (object->properties == NULL && object->ce->default_properties_count <= 1) {
2091+
return NULL;
2092+
} else {
2093+
return zend_std_get_properties(object);
2094+
}
2095+
}
2096+
20802097
zend_object_handlers pdo_dbstmt_object_handlers;
20812098
zend_object_handlers pdo_row_object_handlers;
20822099

@@ -2495,6 +2512,7 @@ void pdo_stmt_init(void)
24952512
pdo_dbstmt_object_handlers.get_method = dbstmt_method_get;
24962513
pdo_dbstmt_object_handlers.compare = zend_objects_not_comparable;
24972514
pdo_dbstmt_object_handlers.clone_obj = NULL;
2515+
pdo_dbstmt_object_handlers.get_gc = dbstmt_get_gc;
24982516

24992517
pdo_row_ce = register_class_PDORow();
25002518
pdo_row_ce->create_object = pdo_row_new;

0 commit comments

Comments
 (0)