com php-src: Added ability to load zend_extensions without absolute path names: main/php_ini.c
| From: | Dmitry Stogov | Date: | Sun, 17 Mar 2013 07:42:25 +0000 |
| Subject: | com php-src: Added ability to load zend_extensions without absolute path names: main/php_ini.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71589@lists.php.net to get a copy of this message | ||
Commit: 0b8b6a727ddd31ff14e4af919c77a3f1b5e2b3f0
Author: Dmitry Stogov <dmitry@zend.com> Sun, 17 Mar 2013 11:42:25 +0400
Parents: 930b272d700a7f854357628e446505fab29906a8
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0b8b6a727ddd31ff14e4af919c77a3f1b5e2b3f0
Log:
Added ability to load zend_extensions without absolute path names
Changed paths:
M main/php_ini.c
Diff:
diff --git a/main/php_ini.c b/main/php_ini.c
index b15a384..59e9ae8 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -357,7 +357,24 @@ static void php_load_php_extension_cb(void *arg TSRMLS_DC)
*/
static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
{
- zend_load_extension(*((char **) arg));
+ char *filename = *((char **) arg);
+ int length = strlen(filename);
+
+ if (IS_ABSOLUTE_PATH(filename, length)) {
+ zend_load_extension(filename);
+ } else {
+ char *libpath;
+ char *extension_dir = INI_STR("extension_dir");
+ int extension_dir_len = strlen(extension_dir);
+
+ if (IS_SLASH(extension_dir[extension_dir_len-1])) {
+ spprintf(&libpath, 0, "%s%s", extension_dir, filename);
+ } else {
+ spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename);
+ }
+ zend_load_extension(libpath);
+ efree(libpath);
+ }
}
/* }}} */