Skip to content

Stop copying zend_module_entry #8551

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

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ PHP 8.2 INTERNALS UPGRADE NOTES
* php_stristr() no longer lowercases the haystack and needle as a side effect.
Call zend_str_tolower() yourself if necessary. You no longer need to copy
the haystack and needle before passing them to php_stristr().
* zend_register_module_ex() no longer copies the module entry.

========================
2. Build system changes
Expand Down
2 changes: 0 additions & 2 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,7 @@ static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p
static void module_destructor_zval(zval *zv) /* {{{ */
{
zend_module_entry *module = (zend_module_entry*)Z_PTR_P(zv);

module_destructor(module);
free(module);
}
/* }}} */

Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -2378,7 +2378,7 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module) /
zend_str_tolower_copy(ZSTR_VAL(lcname), module->name, name_len);

lcname = zend_new_interned_string(lcname);
if ((module_ptr = zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry))) == NULL) {
if ((module_ptr = zend_hash_add_ptr(&module_registry, lcname, module)) == NULL) {
zend_error(E_CORE_WARNING, "Module \"%s\" is already loaded", module->name);
zend_string_release(lcname);
return NULL;
Expand Down Expand Up @@ -3061,7 +3061,6 @@ ZEND_API void zend_post_deactivate_modules(void) /* {{{ */
break;
}
module_destructor(module);
free(module);
zend_string_release_ex(key, 0);
} ZEND_HASH_MAP_FOREACH_END_DEL();
} else {
Expand Down