mirror of
https://github.com/php/php-src.git
synced 2026-04-26 17:38:14 +02:00
fix regression introduced by 0782a7fc63
This commit is contained in:
+27
-27
@@ -110,8 +110,9 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
||||
char *libpath;
|
||||
zend_module_entry *module_entry;
|
||||
zend_module_entry *(*get_module)(void);
|
||||
int error_type, slash_suffix;
|
||||
int error_type, slash_suffix = NULL;
|
||||
char *extension_dir;
|
||||
char *err1, *err2;
|
||||
|
||||
if (type == MODULE_PERSISTENT) {
|
||||
extension_dir = INI_STR("extension_dir");
|
||||
@@ -135,7 +136,6 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
||||
libpath = estrdup(filename);
|
||||
} else if (extension_dir && extension_dir[0]) {
|
||||
int extension_dir_len = (int)strlen(extension_dir);
|
||||
char *err1, *err2;
|
||||
slash_suffix = IS_SLASH(extension_dir[extension_dir_len-1]);
|
||||
/* Try as filename first */
|
||||
if (slash_suffix) {
|
||||
@@ -143,35 +143,35 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
||||
} else {
|
||||
spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); /* SAFE */
|
||||
}
|
||||
|
||||
handle = php_load_shlib(libpath, &err1);
|
||||
if (!handle) {
|
||||
/* Now, consider 'filename' as extension name and build file name */
|
||||
char *orig_libpath = libpath;
|
||||
|
||||
if (slash_suffix) {
|
||||
spprintf(&libpath, 0, "%s" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, filename); /* SAFE */
|
||||
} else {
|
||||
spprintf(&libpath, 0, "%s%c" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, filename); /* SAFE */
|
||||
}
|
||||
|
||||
handle = php_load_shlib(libpath, &err2);
|
||||
if (!handle) {
|
||||
php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' (tried: %s (%s), %s (%s))",
|
||||
filename, orig_libpath, err1, libpath, err2);
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
efree(libpath);
|
||||
efree(err2);
|
||||
return FAILURE;
|
||||
}
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
}
|
||||
} else {
|
||||
return FAILURE; /* Not full path given or extension_dir is not set */
|
||||
}
|
||||
|
||||
handle = php_load_shlib(libpath, &err1);
|
||||
if (!handle) {
|
||||
/* Now, consider 'filename' as extension name and build file name */
|
||||
char *orig_libpath = libpath;
|
||||
|
||||
if (slash_suffix) {
|
||||
spprintf(&libpath, 0, "%s" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, filename); /* SAFE */
|
||||
} else {
|
||||
spprintf(&libpath, 0, "%s%c" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, filename); /* SAFE */
|
||||
}
|
||||
|
||||
handle = php_load_shlib(libpath, &err2);
|
||||
if (!handle) {
|
||||
php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' (tried: %s (%s), %s (%s))",
|
||||
filename, orig_libpath, err1, libpath, err2);
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
efree(libpath);
|
||||
efree(err2);
|
||||
return FAILURE;
|
||||
}
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
}
|
||||
|
||||
efree(libpath);
|
||||
|
||||
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
|
||||
|
||||
Reference in New Issue
Block a user