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