Skip to content

Commit ac7e4e1

Browse files
committed
fix RC_DEBUG assertion
1 parent 5cd4982 commit ac7e4e1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ext/dba/dba.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,7 @@ static void dba_close(dba_info *info)
263263
info->hnd->close(info);
264264
}
265265
ZEND_ASSERT(info->path);
266-
// Cannot use zend_string_release_ex(info->path, info->flags&DBA_PERSISTENT); as this fails GC assertion?
267-
// Zend/zend_rc_debug.c:38: void ZEND_RC_MOD_CHECK(const zend_refcounted_h *): Assertion `(zval_gc_flags(p->u.type_info) & ((1<<7)|(1<<8))) != (1<<7)' failed.
268-
zend_string_free(info->path);
266+
zend_string_release_ex(info->path, info->flags&DBA_PERSISTENT);
269267
info->path = NULL;
270268

271269
if (info->fp && info->fp != info->lock.fp) {
@@ -459,10 +457,14 @@ static dba_info *php_dba_find(const zend_string *path)
459457

460458
static zend_always_inline zend_string *php_dba_zend_string_dup_safe(zend_string *s, bool persistent)
461459
{
462-
if (ZSTR_IS_INTERNED(s) && (!persistent || (GC_FLAGS(s) & IS_STR_PERSISTENT))) {
460+
if (ZSTR_IS_INTERNED(s) && !persistent) {
463461
return s;
464462
} else {
465-
return zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent);
463+
zend_string *duplicated_str = zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent);
464+
if (persistent) {
465+
GC_MAKE_PERSISTENT_LOCAL(duplicated_str);
466+
}
467+
return duplicated_str;
466468
}
467469
}
468470

0 commit comments

Comments
 (0)