]> git.pld-linux.org Git - packages/php.git/blame - php-sapi-ini-file.patch
This commit was manufactured by cvs2git to create branch 'DEVEL'.
[packages/php.git] / php-sapi-ini-file.patch
CommitLineData
c0240cb1 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 @@
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;
02d2dcbb 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);
02d2dcbb 28+ //safe_mode_state = PG(safe_mode);
c0240cb1 29+ open_basedir = PG(open_basedir);
02d2dcbb 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+ }
37
38 /* Otherwise search for php-%sapi-module-name%.ini file in search path */
39 if (!fh.handle.fp) {
40@@ -492,14 +515,6 @@
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) {
55@@ -610,12 +625,14 @@
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";
60
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);
69
70 while (ini_path != NULL) {
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) {
77 memset(&fh2, 0, sizeof(fh2));
78
79 for (i = 0; i < ndir; i++) {
This page took 0.069155 seconds and 4 git commands to generate.