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.
This commit is contained in:
Arnaud Le Blanc 2022-05-24 19:22:55 +02:00 committed by GitHub
parent 9bb97ee8bc
commit 6cda01a05c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -2948,8 +2948,17 @@ static void clean_module_classes(int module_number) /* {{{ */
void module_destructor(zend_module_entry *module) /* {{{ */ void module_destructor(zend_module_entry *module) /* {{{ */
{ {
#if ZEND_RC_DEBUG
bool orig_rc_debug = zend_rc_debug;
#endif
if (module->type == MODULE_TEMPORARY) { if (module->type == MODULE_TEMPORARY) {
#if ZEND_RC_DEBUG
/* FIXME: Loading extensions during the request breaks some invariants.
* In particular, it will create persistent interned strings, which is
* not allowed at this stage. */
zend_rc_debug = false;
#endif
zend_clean_module_rsrc_dtors(module->module_number); zend_clean_module_rsrc_dtors(module->module_number);
clean_module_constants(module->module_number); clean_module_constants(module->module_number);
clean_module_classes(module->module_number); clean_module_classes(module->module_number);
@ -2991,6 +3000,10 @@ void module_destructor(zend_module_entry *module) /* {{{ */
DL_UNLOAD(module->handle); DL_UNLOAD(module->handle);
} }
#endif #endif
#if ZEND_RC_DEBUG
zend_rc_debug = orig_rc_debug;
#endif
} }
/* }}} */ /* }}} */

View file

@ -60,6 +60,9 @@ PHPAPI PHP_FUNCTION(dl)
#if ZEND_RC_DEBUG #if ZEND_RC_DEBUG
bool orig_rc_debug = zend_rc_debug; bool orig_rc_debug = zend_rc_debug;
/* FIXME: Loading extensions during the request breaks some invariants. In
* particular, it will create persistent interned strings, which is not
* allowed at this stage. */
zend_rc_debug = false; zend_rc_debug = false;
#endif #endif