Skip to content

Commit e883407

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Disable zend_rc_debug during dtor of dl()'ed module (#8606)
2 parents b63df3c + 6cda01a commit e883407

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Zend/zend_API.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,8 +2953,17 @@ static void clean_module_classes(int module_number) /* {{{ */
29532953

29542954
void module_destructor(zend_module_entry *module) /* {{{ */
29552955
{
2956+
#if ZEND_RC_DEBUG
2957+
bool orig_rc_debug = zend_rc_debug;
2958+
#endif
29562959

29572960
if (module->type == MODULE_TEMPORARY) {
2961+
#if ZEND_RC_DEBUG
2962+
/* FIXME: Loading extensions during the request breaks some invariants.
2963+
* In particular, it will create persistent interned strings, which is
2964+
* not allowed at this stage. */
2965+
zend_rc_debug = false;
2966+
#endif
29582967
zend_clean_module_rsrc_dtors(module->module_number);
29592968
clean_module_constants(module->module_number);
29602969
clean_module_classes(module->module_number);
@@ -2996,6 +3005,10 @@ void module_destructor(zend_module_entry *module) /* {{{ */
29963005
DL_UNLOAD(module->handle);
29973006
}
29983007
#endif
3008+
3009+
#if ZEND_RC_DEBUG
3010+
zend_rc_debug = orig_rc_debug;
3011+
#endif
29993012
}
30003013
/* }}} */
30013014

ext/standard/dl.c

Lines changed: 3 additions & 0 deletions
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)