summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorFrancois Laupretre <francois@php.net>2017-07-13 14:27:19 +0200
committerAnatol Belski <ab@php.net>2017-07-13 14:27:19 +0200
commit0782a7fc6314c8bd3cbfd57f12d0479bf9cc8dc7 (patch)
tree8c054f98a3d9db3d728bcfd33ff8a00b70b28efb /main
parent613102bd678ab72fca412ce089e942bc33eb4046 (diff)
downloadphp-git-0782a7fc6314c8bd3cbfd57f12d0479bf9cc8dc7.tar.gz
Fixed bug #74866 extension_dir = "./ext" now use current directory for base
Diffstat (limited to 'main')
-rw-r--r--main/php_ini.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/main/php_ini.c b/main/php_ini.c
index 98896a5f86..4e013c8aca 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -362,10 +362,12 @@ static void php_load_zend_extension_cb(void *arg)
if (IS_ABSOLUTE_PATH(filename, length)) {
zend_load_extension(filename);
} else {
+ DL_HANDLE handle;
char *libpath;
char *extension_dir = INI_STR("extension_dir");
int extension_dir_len = (int)strlen(extension_dir);
int slash_suffix = IS_SLASH(extension_dir[extension_dir_len-1]);
+ char *err1, *err2;
/* Try as filename first */
if (slash_suffix) {
spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */
@@ -373,7 +375,8 @@ static void php_load_zend_extension_cb(void *arg)
spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); /* SAFE */
}
- if (VCWD_ACCESS(libpath, F_OK)) {
+ handle = (DL_HANDLE)php_load_shlib(libpath, &err1);
+ if (!handle) {
/* If file does not exist, consider as extension name and build file name */
char *orig_libpath = libpath;
@@ -383,18 +386,22 @@ static void php_load_zend_extension_cb(void *arg)
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)) {
- php_error(E_CORE_WARNING, "Cannot access Zend extension %s (Tried: %s, %s)\n",
- filename, orig_libpath, libpath);
+ handle = (DL_HANDLE)php_load_shlib(libpath, &err2);
+ if (!handle) {
+ php_error(E_CORE_WARNING, "Failed loading Zend extension '%s' (tried: %s (%s), %s (%s))",
+ filename, orig_libpath, err1, libpath, err2);
efree(orig_libpath);
+ efree(err1);
efree(libpath);
+ efree(err2);
return;
}
efree(orig_libpath);
+ efree(err1);
}
- zend_load_extension(libpath);
+ zend_load_extension_handle(handle, libpath);
efree(libpath);
}
}