Skip to content

Commit 6cda01a

Browse files
authored
Disable zend_rc_debug during dtor of dl()'ed module (#8606)
Newly added dl() tests trigger an assertion in ZEND_RC_DEBUG builds. This change disables zend_rc_debug to allows these tests to pass until this issue is resolved.
1 parent 9bb97ee commit 6cda01a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Zend/zend_API.c

+13
Original file line numberDiff line numberDiff line change
@@ -2948,8 +2948,17 @@ static void clean_module_classes(int module_number) /* {{{ */
29482948

29492949
void module_destructor(zend_module_entry *module) /* {{{ */
29502950
{
2951+
#if ZEND_RC_DEBUG
2952+
bool orig_rc_debug = zend_rc_debug;
2953+
#endif
29512954

29522955
if (module->type == MODULE_TEMPORARY) {
2956+
#if ZEND_RC_DEBUG
2957+
/* FIXME: Loading extensions during the request breaks some invariants.
2958+
* In particular, it will create persistent interned strings, which is
2959+
* not allowed at this stage. */
2960+
zend_rc_debug = false;
2961+
#endif
29532962
zend_clean_module_rsrc_dtors(module->module_number);
29542963
clean_module_constants(module->module_number);
29552964
clean_module_classes(module->module_number);
@@ -2991,6 +3000,10 @@ void module_destructor(zend_module_entry *module) /* {{{ */
29913000
DL_UNLOAD(module->handle);
29923001
}
29933002
#endif
3003+
3004+
#if ZEND_RC_DEBUG
3005+
zend_rc_debug = orig_rc_debug;
3006+
#endif
29943007
}
29953008
/* }}} */
29963009

ext/standard/dl.c

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ PHPAPI PHP_FUNCTION(dl)
6060

6161
#if ZEND_RC_DEBUG
6262
bool orig_rc_debug = zend_rc_debug;
63+
/* FIXME: Loading extensions during the request breaks some invariants. In
64+
* particular, it will create persistent interned strings, which is not
65+
* allowed at this stage. */
6366
zend_rc_debug = false;
6467
#endif
6568

0 commit comments

Comments
 (0)