Skip to content

Set zend_rc_debug=false before loading shared ext in FPM config #18075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions sapi/fpm/fpm/fpm_php.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,21 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */
if (!strcmp(name, "extension") && *value) {
zval zv;
zend_interned_strings_switch_storage(0);

#if ZEND_RC_DEBUG
bool orig_rc_debug = zend_rc_debug;
/* Loading extensions after php_module_startup() breaks some invariants.
* For instance, it will update the refcount of persistent strings,
* which is normally not allowed at this stage. */
zend_rc_debug = false;
#endif

php_dl(value, MODULE_PERSISTENT, &zv, 1);

#if ZEND_RC_DEBUG
zend_rc_debug = orig_rc_debug;
#endif

zend_interned_strings_switch_storage(1);
return Z_TYPE(zv) == IS_TRUE ? FPM_PHP_INI_EXTENSION_LOADED : FPM_PHP_INI_EXTENSION_FAILED;
}
Expand Down
Loading