]>
Commit | Line | Data |
---|---|---|
54c11034 ER |
1 | --- php-5.3.0/main/php_ini.c 2009-07-06 17:36:45.529879052 +0200 |
2 | +++ php-5.3.2/main/php_ini.c 2010-03-17 17:55:16.800313459 +0200 | |
3 | @@ -358,6 +358,11 @@ | |
4 | } | |
5 | /* }}} */ | |
6 | ||
7 | +static int php_csort(const struct dirent **a, const struct dirent **b) | |
8 | +{ | |
9 | + return strcmp((*a)->d_name,(*b)->d_name); | |
10 | +} | |
11 | + | |
12 | /* {{{ php_init_config | |
13 | */ | |
14 | int php_init_config(TSRMLS_D) | |
15 | @@ -480,6 +485,24 @@ | |
26a10e8e JR |
16 | } |
17 | } | |
18 | } | |
19 | + /* Search (global) php.ini file in search path */ | |
20 | + if (!fh.handle.fp) { | |
21 | + fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC); | |
22 | + if (fh.handle.fp) { | |
23 | + fh.filename = php_ini_opened_path; | |
24 | + PG(safe_mode) = safe_mode_state; | |
25 | + PG(open_basedir) = open_basedir; | |
26 | + fh.type = ZEND_HANDLE_FP; | |
27 | + zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC); | |
28 | + safe_mode_state = PG(safe_mode); | |
29 | + open_basedir = PG(open_basedir); | |
30 | + PG(safe_mode) = 0; | |
31 | + PG(open_basedir) = NULL; | |
32 | + fh.handle.fp = NULL; | |
33 | + efree(php_ini_opened_path); | |
34 | + fh.filename = php_ini_opened_path = NULL; | |
35 | + } | |
36 | + } | |
37 | ||
38 | /* Otherwise search for php-%sapi-module-name%.ini file in search path */ | |
39 | if (!fh.handle.fp) { | |
54c11034 | 40 | @@ -492,14 +515,6 @@ |
26a10e8e JR |
41 | fh.filename = php_ini_opened_path; |
42 | } | |
43 | } | |
44 | - | |
45 | - /* If still no ini file found, search for php.ini file in search path */ | |
46 | - if (!fh.handle.fp) { | |
47 | - fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC); | |
48 | - if (fh.handle.fp) { | |
49 | - fh.filename = php_ini_opened_path; | |
50 | - } | |
51 | - } | |
52 | } | |
53 | ||
54 | if (free_ini_search_path) { | |
54c11034 | 55 | @@ -610,12 +625,14 @@ |
c14467fd AM |
56 | zend_llist scanned_ini_list; |
57 | zend_llist_element *element; | |
58 | int l, total_l = 0; | |
59 | + const char *fmt = "%s:" PHP_CONFIG_FILE_PATH "/%s.d"; | |
4eea33b4 | 60 | |
c14467fd AM |
61 | /* List of found ini files */ |
62 | zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1); | |
63 | ||
64 | /* Split by paths_separator and load ini-files from all paths */ | |
65 | - path_copy = estrdup(php_ini_scanned_path); | |
66 | + path_copy = emalloc(strlen(php_ini_scanned_path) + strlen(fmt) + strlen(sapi_module.name)); | |
67 | + sprintf(path_copy, fmt, php_ini_scanned_path, sapi_module.name); | |
68 | ini_path = php_strtok_r(path_copy, paths_separator, &last); | |
1015d69e | 69 | |
c14467fd | 70 | while (ini_path != NULL) { |
54c11034 ER |
71 | @@ -636,7 +653,7 @@ |
72 | struct dirent **namelist; | |
73 | int ini_path_len = strlen(ini_path); | |
74 | ||
75 | - if ((ndir = php_scandir(ini_path, &namelist, 0, php_alphasort)) > 0) { | |
76 | + if ((ndir = php_scandir(ini_path, &namelist, 0, php_csort)) > 0) { | |
dc449d5c | 77 | memset(&fh2, 0, sizeof(fh2)); |
54c11034 ER |
78 | |
79 | for (i = 0; i < ndir; i++) { |