]>
Commit | Line | Data |
---|---|---|
7f8058c1 AM |
1 | --- php-5.4.0RC3/main/php_ini.c~ 2011-12-10 03:35:27.000000000 +0200 |
2 | +++ php-5.4.0RC3/main/php_ini.c 2011-12-10 03:36:08.930154336 +0200 | |
3 | @@ -358,6 +358,11 @@ | |
c0240cb1 | 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) | |
7f8058c1 | 15 | @@ -480,6 +485,24 @@ |
c0240cb1 | 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; | |
7f8058c1 | 24 | + //PG(safe_mode) = safe_mode_state; |
c0240cb1 | 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); | |
7f8058c1 | 28 | + //safe_mode_state = PG(safe_mode); |
c0240cb1 | 29 | + open_basedir = PG(open_basedir); |
7f8058c1 | 30 | + //PG(safe_mode) = 0; |
c0240cb1 | 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 | + } | |
7f8058c1 AM |
37 | |
38 | /* Otherwise search for php-%sapi-module-name%.ini file in search path */ | |
c0240cb1 | 39 | if (!fh.handle.fp) { |
7f8058c1 | 40 | @@ -492,14 +515,6 @@ |
c0240cb1 | 41 | fh.filename = php_ini_opened_path; |
42 | } | |
7f8058c1 AM |
43 | } |
44 | - | |
c0240cb1 | 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; | |
7f8058c1 AM |
50 | - } |
51 | - } | |
c0240cb1 | 52 | } |
53 | ||
7f8058c1 AM |
54 | if (free_ini_search_path) { |
55 | @@ -645,13 +645,15 @@ int php_init_config(TSRMLS_D) | |
c0240cb1 | 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"; | |
2e0e7ed6 AM |
60 | char *bufpath, *debpath, *endpath; |
61 | int lenpath; | |
c0240cb1 | 62 | |
c0240cb1 | 63 | zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1); |
2e0e7ed6 | 64 | memset(&fh2, 0, sizeof(fh2)); |
b4025702 | 65 | |
2e0e7ed6 AM |
66 | - bufpath = estrdup(php_ini_scanned_path); |
67 | + bufpath = emalloc(strlen(php_ini_scanned_path) + strlen(fmt) + strlen(sapi_module.name)); | |
68 | + sprintf(bufpath, fmt, php_ini_scanned_path, sapi_module.name); | |
69 | for (debpath = bufpath ; debpath ; debpath=endpath) { | |
70 | endpath = strchr(debpath, DEFAULT_DIR_SEPARATOR); | |
71 | if (endpath) { | |
7f8058c1 | 72 | @@ -664,7 +666,7 @@ int php_init_config(TSRMLS_D) |
2e0e7ed6 AM |
73 | } |
74 | lenpath = strlen(debpath); | |
c0240cb1 | 75 | |
2e0e7ed6 AM |
76 | - if (lenpath > 0 && (ndir = php_scandir(debpath, &namelist, 0, php_alphasort)) > 0) { |
77 | + if (lenpath > 0 && (ndir = php_scandir(debpath, &namelist, 0, php_csort)) > 0) { | |
c0240cb1 | 78 | |
79 | for (i = 0; i < ndir; i++) { | |
2e0e7ed6 | 80 | |
7f8058c1 | 81 |