summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2001-01-15 03:21:05 +0000
committerSascha Schumann <sas@php.net>2001-01-15 03:21:05 +0000
commitdb0b8bc05be985adc61ee0af31b06277077a3252 (patch)
tree1c2f0030ad25ba62c6f905c0f6babb876549c672 /main
parent5951b8063a494208034d26819eb71e2171112ffe (diff)
downloadphp-git-db0b8bc05be985adc61ee0af31b06277077a3252.tar.gz
Defer loading of extensions until all configuration entries have been
added to the configuration hash.
Diffstat (limited to 'main')
-rw-r--r--main/php_globals.h2
-rw-r--r--main/php_ini.c25
2 files changed, 23 insertions, 4 deletions
diff --git a/main/php_globals.h b/main/php_globals.h
index aa313a4075..b01d823b76 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -124,6 +124,8 @@ struct _php_core_globals {
zend_bool during_request_startup;
zend_bool allow_url_fopen;
+
+ zend_llist ini_extension_list;
};
diff --git a/main/php_ini.c b/main/php_ini.c
index ce1b330156..52bbeec1a4 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -117,7 +117,6 @@ static void pvalue_config_destructor(zval *pvalue)
}
}
-
static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
{
switch (callback_type) {
@@ -128,9 +127,13 @@ static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
break;
}
if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */
- zval dummy;
-
- php_dl(arg2, MODULE_PERSISTENT, &dummy);
+ zval copy;
+ PLS_FETCH();
+
+ copy = *arg2;
+ zval_copy_ctor(&copy);
+ copy.refcount = 0;
+ zend_llist_add_element(&PG(ini_extension_list), &copy);
} else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
zend_load_extension(Z_STRVAL_P(arg2));
} else {
@@ -144,6 +147,15 @@ static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
}
}
+static void php_apply_ini_extension_list(void *dummy)
+{
+ zval *extension = (zval *) dummy;
+ zval zval;
+
+ php_dl(extension, MODULE_PERSISTENT, &zval);
+ zval_dtor(extension);
+}
+
int php_init_config(char *php_ini_path_override)
{
@@ -158,6 +170,8 @@ int php_init_config(char *php_ini_path_override)
return FAILURE;
}
+ zend_llist_init(&PG(ini_extension_list), sizeof(zval), NULL, 1);
+
safe_mode_state = PG(safe_mode);
open_basedir = PG(open_basedir);
@@ -209,6 +223,9 @@ int php_init_config(char *php_ini_path_override)
zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, NULL);
+ zend_llist_apply(&PG(ini_extension_list), php_apply_ini_extension_list);
+ zend_llist_destroy(&PG(ini_extension_list));
+
if (php_ini_opened_path) {
zval tmp;