]>
Commit | Line | Data |
---|---|---|
9d6174b1 | 1 | --- php-4.2.1/main/php_ini.c.orig Tue Mar 5 01:21:28 2002 |
2 | +++ php-4.2.1/main/php_ini.c Wed Jun 12 18:10:30 2002 | |
3 | @@ -204,6 +204,8 @@ | |
4 | char *env_location, *php_ini_search_path; | |
5 | int safe_mode_state; | |
6 | char *open_basedir; | |
7 | + char *sapi_ini_filename; | |
8 | + char *sapi_ini_opened_path; | |
9 | int free_ini_search_path=0; | |
10 | zend_file_handle fh; | |
11 | TSRMLS_FETCH(); | |
12 | @@ -264,15 +266,10 @@ | |
13 | PG(open_basedir) = NULL; | |
14 | ||
15 | fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC); | |
16 | - if (free_ini_search_path) { | |
17 | - efree(php_ini_search_path); | |
18 | - } | |
19 | PG(safe_mode) = safe_mode_state; | |
20 | PG(open_basedir) = open_basedir; | |
21 | ||
22 | - if (!fh.handle.fp) { | |
23 | - return SUCCESS; /* having no configuration file is ok */ | |
24 | - } | |
25 | + if (fh.handle.fp) { | |
26 | fh.type = ZEND_HANDLE_FP; | |
27 | fh.filename = php_ini_opened_path; | |
28 | ||
29 | @@ -288,7 +285,31 @@ | |
30 | efree(php_ini_opened_path); | |
31 | php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); | |
32 | } | |
33 | - | |
34 | + } | |
35 | + | |
36 | + sapi_ini_filename = do_alloca(7+1+strlen(sapi_module.name)+1); | |
37 | + if(sapi_ini_filename == NULL) { | |
38 | + if (free_ini_search_path) | |
39 | + efree(php_ini_search_path); | |
40 | + return SUCCESS; | |
41 | + } | |
42 | + sprintf(sapi_ini_filename,"php-%s.ini",sapi_module.name); | |
43 | + fh.handle.fp = php_fopen_with_path(sapi_ini_filename, "r", php_ini_search_path, &sapi_ini_opened_path TSRMLS_CC); | |
44 | + if (free_ini_search_path) { | |
45 | + efree(php_ini_search_path); | |
46 | + } | |
47 | + if (!fh.handle.fp) { | |
48 | + return SUCCESS; /* having no configuration file is ok */ | |
49 | + } | |
50 | + fh.type = ZEND_HANDLE_FP; | |
51 | + fh.filename = sapi_ini_opened_path; | |
52 | + | |
53 | + zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists); | |
54 | + | |
55 | + if (sapi_ini_opened_path) | |
56 | + efree(sapi_ini_opened_path); | |
57 | + free_alloca(sapi_ini_filename); | |
58 | + | |
59 | return SUCCESS; | |
60 | } | |
61 | /* }}} */ |