Skip to content

Commit 09ab4ae

Browse files
committed
Revert "Stop copying zend_module_entry (php#8551)"
This reverts commit b63df3c.
1 parent c801076 commit 09ab4ae

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

UPGRADING.INTERNALS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ PHP 8.2 INTERNALS UPGRADE NOTES
2222
* php_stristr() no longer lowercases the haystack and needle as a side effect.
2323
Call zend_str_tolower() yourself if necessary. You no longer need to copy
2424
the haystack and needle before passing them to php_stristr().
25-
* zend_register_module_ex() no longer copies the module entry.
2625
* The main/php_stdint.h header has been removed.
2726
Include the standard <inttypes.h> and/or <stdint.h> headers instead.
2827
Replace usage of u_char by the standard C99 uint8_t type.

Zend/zend.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,9 @@ static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p
840840
static void module_destructor_zval(zval *zv) /* {{{ */
841841
{
842842
zend_module_entry *module = (zend_module_entry*)Z_PTR_P(zv);
843+
843844
module_destructor(module);
845+
free(module);
844846
}
845847
/* }}} */
846848

Zend/zend_API.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2411,7 +2411,7 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module) /
24112411
zend_str_tolower_copy(ZSTR_VAL(lcname), module->name, name_len);
24122412

24132413
lcname = zend_new_interned_string(lcname);
2414-
if ((module_ptr = zend_hash_add_ptr(&module_registry, lcname, module)) == NULL) {
2414+
if ((module_ptr = zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry))) == NULL) {
24152415
zend_error(E_CORE_WARNING, "Module \"%s\" is already loaded", module->name);
24162416
zend_string_release(lcname);
24172417
return NULL;
@@ -3143,6 +3143,7 @@ ZEND_API void zend_post_deactivate_modules(void) /* {{{ */
31433143
break;
31443144
}
31453145
module_destructor(module);
3146+
free(module);
31463147
zend_string_release_ex(key, 0);
31473148
} ZEND_HASH_MAP_FOREACH_END_DEL();
31483149
} else {

0 commit comments

Comments
 (0)