diff options
-rw-r--r-- | ext/standard/dl.c | 10 | ||||
-rw-r--r-- | main/build-defs.h.in | 1 | ||||
-rw-r--r-- | main/php_ini.c | 8 | ||||
-rw-r--r-- | win32/build/config.w32.h.in | 1 |
4 files changed, 8 insertions, 12 deletions
diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 050516639e..5adae805ce 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -116,17 +116,15 @@ 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 */ } + if (VCWD_ACCESS(libpath, F_OK)) { /* If file does not exist, consider as extension name and build file name */ - const char *libpath_prefix = ""; char *orig_libpath = libpath; -#if PHP_WIN32 - libpath_prefix = "php_"; -#endif + if (slash_suffix) { - spprintf(&libpath, 0, "%s%s%s." PHP_SHLIB_SUFFIX, extension_dir, libpath_prefix, filename); /* SAFE */ + spprintf(&libpath, 0, "%s" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, filename); /* SAFE */ } else { - spprintf(&libpath, 0, "%s%c%s%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, libpath_prefix, filename); /* SAFE */ + spprintf(&libpath, 0, "%s%c" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, filename); /* SAFE */ } if (VCWD_ACCESS(libpath, F_OK)) { diff --git a/main/build-defs.h.in b/main/build-defs.h.in index c82982a32a..fb9bc7f881 100644 --- a/main/build-defs.h.in +++ b/main/build-defs.h.in @@ -89,3 +89,4 @@ #define PHP_CONFIG_FILE_PATH "@EXPANDED_PHP_CONFIG_FILE_PATH@" #define PHP_CONFIG_FILE_SCAN_DIR "@EXPANDED_PHP_CONFIG_FILE_SCAN_DIR@" #define PHP_SHLIB_SUFFIX "@SHLIB_DL_SUFFIX_NAME@" +#define PHP_SHLIB_EXT_PREFIX "" diff --git a/main/php_ini.c b/main/php_ini.c index 8b53f30441..98896a5f86 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -375,16 +375,12 @@ static void php_load_zend_extension_cb(void *arg) if (VCWD_ACCESS(libpath, F_OK)) { /* If file does not exist, consider as extension name and build file name */ - const char *libpath_prefix = ""; char *orig_libpath = libpath; -#if PHP_WIN32 - libpath_prefix = "php_"; -#endif if (slash_suffix) { - spprintf(&libpath, 0, "%s%s%s." PHP_SHLIB_SUFFIX, extension_dir, libpath_prefix, filename); /* SAFE */ + spprintf(&libpath, 0, "%s" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, filename); /* SAFE */ } else { - spprintf(&libpath, 0, "%s%c%s%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, libpath_prefix, filename); /* SAFE */ + spprintf(&libpath, 0, "%s%c" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, filename); /* SAFE */ } if (VCWD_ACCESS(libpath, F_OK)) { diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in index 573eb95a94..9572f65d82 100644 --- a/win32/build/config.w32.h.in +++ b/win32/build/config.w32.h.in @@ -136,6 +136,7 @@ #define HAVE_FNMATCH #define HAVE_GLOB #define PHP_SHLIB_SUFFIX "dll" +#define PHP_SHLIB_EXT_PREFIX "php_" #define HAVE_SQLDATASOURCES /* Win32 supports strcoll */ |