Skip to content

Commit 0bfdd56

Browse files
committed
Fix crash reading module_entry after DL_UNLOAD() when module already loaded
This occurs when the handle is different from the current handle (e.g. copy of the .so file), hence the existing test did not catch that particular case.
1 parent 4052bbf commit 0bfdd56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/dl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ PHPAPI int php_load_extension(const char *filename, int type, int start_now)
206206
}
207207
module_entry = get_module();
208208
if (zend_hash_str_exists(&module_registry, module_entry->name, strlen(module_entry->name))) {
209-
DL_UNLOAD(handle);
210209
zend_error(E_CORE_WARNING, "Module \"%s\" is already loaded", module_entry->name);
210+
DL_UNLOAD(handle);
211211
return FAILURE;
212212
}
213213
if (module_entry->zend_api != ZEND_MODULE_API_NO) {

0 commit comments

Comments
 (0)