Skip to content

Revert "Stop copying zend_module_entry (#8551)" #9648

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
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: 0 additions & 1 deletion UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ 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.
* The main/php_stdint.h header has been removed.
Include the standard <inttypes.h> and/or <stdint.h> headers instead.
Replace usage of u_char by the standard C99 uint8_t type.
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,9 @@ 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: 2 additions & 1 deletion Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,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_ptr(&module_registry, lcname, module)) == NULL) {
if ((module_ptr = zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry))) == NULL) {
zend_error(E_CORE_WARNING, "Module \"%s\" is already loaded", module->name);
zend_string_release(lcname);
return NULL;
Expand Down Expand Up @@ -3143,6 +3143,7 @@ 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