From 171c3bf86244a5581a086f7f5c335b7e8d5a5bb1 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Sun, 22 May 2022 19:10:48 +0200 Subject: [PATCH] Disable zend_rc_debug during dtor of dl()'ed module 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. --- Zend/zend_API.c | 13 +++++++++++++ ext/standard/dl.c | 3 +++ 2 files changed, 16 insertions(+) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index e21e42c585313..1684fd50dc860 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2948,8 +2948,17 @@ static void clean_module_classes(int module_number) /* {{{ */ 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 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); clean_module_constants(module->module_number); clean_module_classes(module->module_number); @@ -2991,6 +3000,10 @@ void module_destructor(zend_module_entry *module) /* {{{ */ DL_UNLOAD(module->handle); } #endif + +#if ZEND_RC_DEBUG + zend_rc_debug = orig_rc_debug; +#endif } /* }}} */ diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 40608c9ec7ae5..90e538f19d4ac 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -60,6 +60,9 @@ PHPAPI PHP_FUNCTION(dl) #if 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; #endif