1 --- php-4.3.0/main/php_ini.c Sat Jan 4 12:22:39 2003
2 +++ php-4.4.2/main/php_ini.c 2006-04-04 18:50:17.756460517 +0300
7 + /* Search (global) php.ini file in search path */
9 + fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
11 + fh.filename = php_ini_opened_path;
12 + PG(safe_mode) = safe_mode_state;
13 + PG(open_basedir) = open_basedir;
14 + fh.type = ZEND_HANDLE_FP;
15 + zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
16 + safe_mode_state = PG(safe_mode);
17 + open_basedir = PG(open_basedir);
19 + PG(open_basedir) = NULL;
20 + fh.handle.fp = NULL;
21 + efree(php_ini_opened_path);
22 + fh.filename = php_ini_opened_path = NULL;
25 /* Search php-%sapi-module-name%.ini file in search path */
27 const char *fmt = "php-%s.ini";
31 - /* Search php.ini file in search path */
32 - if (!fh.handle.fp) {
33 - fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
35 - fh.filename = php_ini_opened_path;
39 if (free_ini_search_path) {
41 * parse any .ini files found in this directory. */
42 if (!sapi_module.php_ini_ignore && strlen(PHP_CONFIG_FILE_SCAN_DIR)) {
43 struct dirent **namelist;
45 + int ndir, i, found = 0;
46 + const char *fmt = PHP_CONFIG_FILE_PATH "/%s.d";
47 + char *sapi_scan_dir = emalloc(strlen(fmt) + strlen(sapi_module.name));
48 + sprintf(sapi_scan_dir, fmt, sapi_module.name);
50 if ((ndir = php_scandir(PHP_CONFIG_FILE_SCAN_DIR, &namelist, 0, php_alphasort)) > 0) {
52 for (i = 0; i < ndir; i++) {
53 /* check for a .ini extension */
54 if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
61 + if ((ndir = php_scandir(sapi_scan_dir, &namelist, 0, php_alphasort)) > 0) {
64 + for (i = 0; i < ndir; i++) {
65 + /* check for a .ini extension */
66 + if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
70 + snprintf(ini_file, MAXPATHLEN, "%s%c%s", sapi_scan_dir, DEFAULT_SLASH, namelist[i]->d_name);
71 + if (VCWD_STAT(ini_file, &sb) == 0) {
72 + if (S_ISREG(sb.st_mode)) {
73 + if ((fh.handle.fp = VCWD_FOPEN(ini_file, "r"))) {
74 + fh.filename = ini_file;
75 + fh.type = ZEND_HANDLE_FP;
76 + zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
77 + /* Here, add it to the list of ini files read */
78 + l = strlen(ini_file);
80 + p = estrndup(ini_file, l);
81 + zend_llist_add_element(&scanned_ini_list, &p);
89 + efree(sapi_scan_dir);
93 * Don't need an extra byte for the \0 in this malloc as the last
94 * element will not get a trailing , which gives us the byte for the \0