Skip to content
Newer
Older
100644 633 lines (562 sloc) 16.9 KB
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
1 /*
2 +----------------------------------------------------------------------+
dbeb415 @andigutmans - A belated happy holidays and PHP 5
andigutmans authored Jan 8, 2004
3 | PHP Version 5 |
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
4 +----------------------------------------------------------------------+
dbeb415 @andigutmans - A belated happy holidays and PHP 5
andigutmans authored Jan 8, 2004
5 | Copyright (c) 1997-2004 The PHP Group |
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
6 +----------------------------------------------------------------------+
f68c7ff updating license information in the headers.
James Cox authored Jun 10, 2003
7 | This source file is subject to version 3.0 of the PHP license, |
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored Jun 10, 2003
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_0.txt. |
c5724cb @zsuraski License update
zsuraski authored Jul 16, 1999
11 | If you did not receive a copy of the PHP license and are unable to |
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
14 +----------------------------------------------------------------------+
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
15 | Author: Zeev Suraski <zeev@zend.com> |
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
16 +----------------------------------------------------------------------+
17 */
18
46a7b0c @fmk Killing compiler warning on Win32
fmk authored Mar 5, 2002
19 /* $Id$ */
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
20
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
21 /* Check CWD for php.ini */
22 #define INI_CHECK_CWD
23
aceaabc @zsuraski PHP 4.0
zsuraski authored Apr 7, 1999
24 #include "php.h"
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
25 #include "ext/standard/info.h"
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
26 #include "zend_ini.h"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
27 #include "php_ini.h"
28 #include "ext/standard/dl.h"
29 #include "zend_extensions.h"
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
30 #include "zend_highlight.h"
ab25640 @edinkad Removed CWD from php_ini_search_path when using CLI SAPI.
edinkad authored Feb 28, 2002
31 #include "SAPI.h"
46a7b0c @fmk Killing compiler warning on Win32
fmk authored Mar 5, 2002
32 #include "php_main.h"
ec11fe0 Fix the possible conflicts with other libs (like libc-client)
foobar authored Feb 19, 2003
33 #include "php_scandir.h"
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored Oct 19, 2003
34 #ifdef PHP_WIN32
35 #include "win32/php_registry.h"
36 #endif
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
37
ec11fe0 Fix the possible conflicts with other libs (like libc-client)
foobar authored Feb 19, 2003
38 #if HAVE_SCANDIR && HAVE_ALPHASORT && HAVE_DIRENT_H
39 #include <dirent.h>
82f6cef Fix broken build by adding scandir and alphasort for win32
Shane Caraveo authored Jan 26, 2003
40 #endif
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored Jan 25, 2003
41
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
42 #ifndef S_ISREG
43 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
44 #endif
45
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
46 typedef struct _php_extension_lists {
42c82bb Revert the last patches.
foobar authored May 9, 2002
47 zend_llist engine;
48 zend_llist functions;
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
49 } php_extension_lists;
58e24ac @zsuraski - Add PHP Modules workspace
zsuraski authored Aug 13, 1999
50
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
51
52 /* True globals */
53 static HashTable configuration_hash;
54 PHPAPI char *php_ini_opened_path=NULL;
55 static php_extension_lists extension_lists;
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
56 PHPAPI char *php_ini_scanned_files=NULL;
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
57
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
58 /* {{{ php_ini_displayer_cb
59 */
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
60 static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
61 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
62 if (ini_entry->displayer) {
63 ini_entry->displayer(ini_entry, type);
64 } else {
65 char *display_string;
66 uint display_string_length, esc_html=0;
67 TSRMLS_FETCH();
68
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
69 if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
42c82bb Revert the last patches.
foobar authored May 9, 2002
70 if (ini_entry->orig_value && ini_entry->orig_value[0]) {
71 display_string = ini_entry->orig_value;
72 display_string_length = ini_entry->orig_value_length;
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored Mar 29, 2003
73 esc_html = !sapi_module.phpinfo_as_text;
42c82bb Revert the last patches.
foobar authored May 9, 2002
74 } else {
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored Mar 29, 2003
75 if (!sapi_module.phpinfo_as_text) {
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored Aug 29, 2002
76 display_string = "<i>no value</i>";
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
77 display_string_length = sizeof("<i>no value</i>") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored Aug 29, 2002
78 } else {
79 display_string = "no value";
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
80 display_string_length = sizeof("no value") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored Aug 29, 2002
81 }
42c82bb Revert the last patches.
foobar authored May 9, 2002
82 }
83 } else if (ini_entry->value && ini_entry->value[0]) {
84 display_string = ini_entry->value;
85 display_string_length = ini_entry->value_length;
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored Mar 29, 2003
86 esc_html = !sapi_module.phpinfo_as_text;
42c82bb Revert the last patches.
foobar authored May 9, 2002
87 } else {
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored Mar 29, 2003
88 if (!sapi_module.phpinfo_as_text) {
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored Aug 29, 2002
89 display_string = "<i>no value</i>";
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
90 display_string_length = sizeof("<i>no value</i>") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored Aug 29, 2002
91 } else {
92 display_string = "no value";
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
93 display_string_length = sizeof("no value") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored Aug 29, 2002
94 }
42c82bb Revert the last patches.
foobar authored May 9, 2002
95 }
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
96
97 if (esc_html) {
a769454 reenable php_html_puts
Sascha Schumann authored May 12, 2002
98 php_html_puts(display_string, display_string_length TSRMLS_CC);
42c82bb Revert the last patches.
foobar authored May 9, 2002
99 } else {
100 PHPWRITE(display_string, display_string_length);
101 }
102 }
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
103 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
104 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
105
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
106 /* {{{ php_ini_displayer
107 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
108 static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number TSRMLS_DC)
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
109 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
110 if (ini_entry->module_number != module_number) {
111 return 0;
112 }
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored Mar 29, 2003
113 if (!sapi_module.phpinfo_as_text) {
14a6cc8 Change phpinfo() to use CSS styling instead of HTML code.
Colin Viebrock authored Sep 19, 2002
114 PUTS("<tr>");
c7c275b fix phpinfo() output for better browser BC
Colin Viebrock authored Sep 26, 2002
115 PUTS("<td class=\"e\">");
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
116 PHPWRITE(ini_entry->name, ini_entry->name_length - 1);
c7c275b fix phpinfo() output for better browser BC
Colin Viebrock authored Sep 26, 2002
117 PUTS("</td><td class=\"v\">");
6676617 - add phpinfo() support for CLI.
Jan Lehnardt authored Aug 28, 2002
118 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
c7c275b fix phpinfo() output for better browser BC
Colin Viebrock authored Sep 26, 2002
119 PUTS("</td><td class=\"v\">");
6676617 - add phpinfo() support for CLI.
Jan Lehnardt authored Aug 28, 2002
120 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
121 PUTS("</td></tr>\n");
122 } else {
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
123 PHPWRITE(ini_entry->name, ini_entry->name_length - 1);
6676617 - add phpinfo() support for CLI.
Jan Lehnardt authored Aug 28, 2002
124 PUTS(" => ");
125 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
126 PUTS(" => ");
127 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
128 PUTS("\n");
129 }
42c82bb Revert the last patches.
foobar authored May 9, 2002
130 return 0;
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
131 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
132 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
133
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
134 /* {{{ display_ini_entries
135 */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
136 PHPAPI void display_ini_entries(zend_module_entry *module)
137 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
138 int module_number;
139 TSRMLS_FETCH();
140
141 if (module) {
142 module_number = module->module_number;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
143 } else {
42c82bb Revert the last patches.
foobar authored May 9, 2002
144 module_number = 0;
145 }
146 php_info_print_table_start();
147 php_info_print_table_header(3, "Directive", "Local Value", "Master Value");
2f4ed25 @zsuraski Compat fix
zsuraski authored Sep 23, 2002
148 zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (long) module_number TSRMLS_CC);
42c82bb Revert the last patches.
foobar authored May 9, 2002
149 php_info_print_table_end();
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
150 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
151 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
152
153 /* php.ini support */
154
155 #ifdef ZTS
156 # if (ZEND_DEBUG)
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
157 # define ZEND_EXTENSION_TOKEN "zend_extension_debug_ts"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
158 # else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
159 # define ZEND_EXTENSION_TOKEN "zend_extension_ts"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
160 # endif
161 #else
162 # if (ZEND_DEBUG)
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
163 # define ZEND_EXTENSION_TOKEN "zend_extension_debug"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
164 # else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
165 # define ZEND_EXTENSION_TOKEN "zend_extension"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
166 # endif
167 #endif
168
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
169 /* {{{ pvalue_config_destructor
170 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
171 static void pvalue_config_destructor(zval *pvalue)
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
172 {
56f8195 @andigutmans - Nuke empty_string. It is a reminanent from the time where RETURN_FA…
andigutmans authored Jul 19, 2004
173 if (Z_TYPE_P(pvalue) == IS_STRING) {
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
174 free(Z_STRVAL_P(pvalue));
175 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
176 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
177 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
178
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
179 /* {{{ php_config_ini_parser_cb
180 */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
181 static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
182 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
183 switch (callback_type) {
184 case ZEND_INI_PARSER_ENTRY: {
185 zval *entry;
186
187 if (!arg2) {
188 break;
189 }
190 if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */
191 zval copy;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
192
42c82bb Revert the last patches.
foobar authored May 9, 2002
193 copy = *arg2;
194 zval_copy_ctor(&copy);
195 copy.refcount = 0;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
196 zend_llist_add_element(&extension_lists.functions, &copy);
42c82bb Revert the last patches.
foobar authored May 9, 2002
197 } else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
198 char *extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
199
42c82bb Revert the last patches.
foobar authored May 9, 2002
200 zend_llist_add_element(&extension_lists.engine, &extension_name);
201 } else {
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
202 zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry);
42c82bb Revert the last patches.
foobar authored May 9, 2002
203 Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
204 }
205 }
206 break;
b51b6f0 ini patch to allow 'entry[] = value' entries
Harald Radi authored Jan 19, 2003
207
208 case ZEND_INI_PARSER_POP_ENTRY: {
209 zval *hash;
210 zval **find_hash;
211 zval *element;
212
213 if (!arg2) {
214 /* bare string - nothing to do */
215 break;
216 }
217
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
218 if (zend_hash_find(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_hash) == FAILURE) {
b51b6f0 ini patch to allow 'entry[] = value' entries
Harald Radi authored Jan 19, 2003
219 ALLOC_ZVAL(hash);
220 array_init(hash);
221
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
222 zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &hash, sizeof(zval *), NULL);
b51b6f0 ini patch to allow 'entry[] = value' entries
Harald Radi authored Jan 19, 2003
223 } else {
224 hash = *find_hash;
225 }
226
227 ALLOC_ZVAL(element);
228 *element = *arg2;
229 zval_copy_ctor(element);
230 INIT_PZVAL(element);
231 add_next_index_zval(hash, element);
232 }
233 break;
234
42c82bb Revert the last patches.
foobar authored May 9, 2002
235 case ZEND_INI_PARSER_SECTION:
236 break;
237 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
238 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
239 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
240
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
241 /* {{{ php_load_function_extension_cb
242 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
243 static void php_load_function_extension_cb(void *arg TSRMLS_DC)
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
244 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
245 zval *extension = (zval *) arg;
246 zval zval;
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
247
42c82bb Revert the last patches.
foobar authored May 9, 2002
248 php_dl(extension, MODULE_PERSISTENT, &zval TSRMLS_CC);
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
249 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
250 /* }}} */
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
251
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
252 /* {{{ php_load_zend_extension_cb
253 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
254 static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
255 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
256 zend_load_extension(*((char **) arg));
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
257 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
258 /* }}} */
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
259
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
260 /* {{{ php_init_config
261 */
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
262 int php_init_config()
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
263 {
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
264 char *env_location, *php_ini_search_path;
265 char *binary_location;
42c82bb Revert the last patches.
foobar authored May 9, 2002
266 int safe_mode_state;
267 char *open_basedir;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
268 int free_ini_search_path=0;
42c82bb Revert the last patches.
foobar authored May 9, 2002
269 zend_file_handle fh;
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
270 struct stat sb;
271 char ini_file[MAXPATHLEN];
272 char *p;
273 zend_llist scanned_ini_list;
274 int l, total_l=0;
275 zend_llist_element *element;
42c82bb Revert the last patches.
foobar authored May 9, 2002
276 TSRMLS_FETCH();
277
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
278 if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1) == FAILURE) {
42c82bb Revert the last patches.
foobar authored May 9, 2002
279 return FAILURE;
280 }
281
63739c7 give sapi modules the possibility to overwrite default ini settings
Marcus Boerger authored Mar 18, 2003
282 if (sapi_module.ini_defaults) {
283 sapi_module.ini_defaults(&configuration_hash);
284 }
285
42c82bb Revert the last patches.
foobar authored May 9, 2002
286 zend_llist_init(&extension_lists.engine, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
287 zend_llist_init(&extension_lists.functions, sizeof(zval), (llist_dtor_func_t) ZVAL_DESTRUCTOR, 1);
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
288 zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
289
42c82bb Revert the last patches.
foobar authored May 9, 2002
290 safe_mode_state = PG(safe_mode);
291 open_basedir = PG(open_basedir);
292
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
293 env_location = getenv("PHPRC");
294 if (!env_location) {
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
295 env_location = "";
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
296 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
297 if (sapi_module.php_ini_path_override) {
298 php_ini_search_path = sapi_module.php_ini_path_override;
299 free_ini_search_path = 0;
300 } else {
301 char *default_location;
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored Aug 12, 2002
302 static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
2479384 Fixed unused variable warning on *nix.
Ilia Alshanetsky authored Oct 20, 2003
303 #ifdef PHP_WIN32
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored Oct 19, 2003
304 char *reg_location;
2479384 Fixed unused variable warning on *nix.
Ilia Alshanetsky authored Oct 20, 2003
305 #endif
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
306
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored Oct 19, 2003
307 php_ini_search_path = (char *) emalloc(MAXPATHLEN * 4 + strlen(env_location) + 3 + 1);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
308 free_ini_search_path = 1;
309 php_ini_search_path[0] = 0;
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
310
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored Oct 19, 2003
311 #ifdef PHP_WIN32
312 /* Add registry location */
313 reg_location = GetIniPathFromRegistry();
314 if(reg_location != NULL) {
315 if (*php_ini_search_path) {
316 strcat(php_ini_search_path, paths_separator);
317 }
318 strcat(php_ini_search_path, reg_location);
319 efree(reg_location);
320 }
321 #endif
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
322 /*
323 * Prepare search path
324 */
42c82bb Revert the last patches.
foobar authored May 9, 2002
325
2629613 Fix PHPRC overriding other ini files. This is how PHPRC worked prior to
Shane Caraveo authored Mar 22, 2003
326 /* Add environment location */
327 if (env_location[0]) {
328 if (*php_ini_search_path) {
329 strcat(php_ini_search_path, paths_separator);
330 }
331 strcat(php_ini_search_path, env_location);
332 }
333
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
334 /* Add cwd */
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
335 #ifdef INI_CHECK_CWD
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
336 if (strcmp(sapi_module.name, "cli") != 0) {
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored Aug 12, 2002
337 if (*php_ini_search_path) {
338 strcat(php_ini_search_path, paths_separator);
339 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
340 strcat(php_ini_search_path, ".");
341 }
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
342 #endif
42c82bb Revert the last patches.
foobar authored May 9, 2002
343
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
344 /* Add binary directory */
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
345 #ifdef PHP_WIN32
b9fd107 @zsuraski Use portable #define
zsuraski authored May 11, 2002
346 binary_location = (char *) emalloc(MAXPATHLEN);
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
347 if (GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) {
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
348 efree(binary_location);
349 binary_location = NULL;
42c82bb Revert the last patches.
foobar authored May 9, 2002
350 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
351 #else
352 if (sapi_module.executable_location) {
353 binary_location = estrdup(sapi_module.executable_location);
354 } else {
355 binary_location = NULL;
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
356 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
357 #endif
358 if (binary_location) {
359 char *separator_location = strrchr(binary_location, DEFAULT_SLASH);
360
361 if (separator_location) {
362 *(separator_location+1) = 0;
363 }
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored Aug 12, 2002
364 if (*php_ini_search_path) {
365 strcat(php_ini_search_path, paths_separator);
366 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
367 strcat(php_ini_search_path, binary_location);
368 efree(binary_location);
369 }
370
371 /* Add default location */
372 #ifdef PHP_WIN32
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
373 default_location = (char *) emalloc(MAXPATHLEN + 1);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
374
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored Aug 12, 2002
375 if (0 < GetWindowsDirectory(default_location, MAXPATHLEN)) {
376 if (*php_ini_search_path) {
377 strcat(php_ini_search_path, paths_separator);
378 }
379 strcat(php_ini_search_path, default_location);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
380 }
381 efree(default_location);
fcdda2e @wez Fix a problem resolving the php.ini path under win32 terminal service…
wez authored Dec 6, 2003
382
383 {
384 /* For people running under terminal services, GetWindowsDirectory will
385 * return their personal Windows directory, so lets add the system
386 * windows directory too */
387 typedef UINT (WINAPI *get_system_windows_directory_func)(char *buffer, UINT size);
388 static get_system_windows_directory_func get_system_windows_directory = NULL;
389 HMODULE kern;
390
391 if (get_system_windows_directory == NULL) {
392 kern = LoadLibrary("kernel32.dll");
393 if (kern) {
394 get_system_windows_directory = (get_system_windows_directory_func)GetProcAddress(kern, "GetSystemWindowsDirectoryA");
395 }
396 }
397 if (get_system_windows_directory != NULL) {
398 default_location = (char *) emalloc(MAXPATHLEN + 1);
399 if (0 < get_system_windows_directory(default_location, MAXPATHLEN)) {
400 if (*php_ini_search_path) {
401 strcat(php_ini_search_path, paths_separator);
402 }
403 strcat(php_ini_search_path, default_location);
404 }
405 efree(default_location);
406 }
407 }
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
408 #else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
409 default_location = PHP_CONFIG_FILE_PATH;
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored Aug 12, 2002
410 if (*php_ini_search_path) {
411 strcat(php_ini_search_path, paths_separator);
412 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
413 strcat(php_ini_search_path, default_location);
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
414 #endif
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
415 }
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored May 9, 2002
416
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
417 PG(safe_mode) = 0;
418 PG(open_basedir) = NULL;
419
e52aac9 @wez Implement simple stream support in the ZE scanners.
wez authored Feb 18, 2003
420 memset(&fh, 0, sizeof(fh));
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
421 /* Check if php_ini_path_override is a file */
cecb9df Implemented -n switch to skip parsing ini at startup as suggested by …
Marcus Boerger authored Nov 12, 2002
422 if (!sapi_module.php_ini_ignore) {
423 if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) {
424 struct stat statbuf;
425
426 if (!VCWD_STAT(sapi_module.php_ini_path_override, &statbuf)) {
427 if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
428 fh.handle.fp = VCWD_FOPEN(sapi_module.php_ini_path_override, "r");
429 fh.filename = sapi_module.php_ini_path_override;
430 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
431 }
432 }
cecb9df Implemented -n switch to skip parsing ini at startup as suggested by …
Marcus Boerger authored Nov 12, 2002
433 /* Search php-%sapi-module-name%.ini file in search path */
434 if (!fh.handle.fp) {
435 const char *fmt = "php-%s.ini";
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
436 char *ini_fname = emalloc(strlen(fmt) + strlen(sapi_module.name));
cecb9df Implemented -n switch to skip parsing ini at startup as suggested by …
Marcus Boerger authored Nov 12, 2002
437 sprintf(ini_fname, fmt, sapi_module.name);
438 fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
439 efree(ini_fname);
440 if (fh.handle.fp) {
441 fh.filename = php_ini_opened_path;
442 }
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored Aug 12, 2002
443 }
cecb9df Implemented -n switch to skip parsing ini at startup as suggested by …
Marcus Boerger authored Nov 12, 2002
444 /* Search php.ini file in search path */
445 if (!fh.handle.fp) {
446 fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
447 if (fh.handle.fp) {
448 fh.filename = php_ini_opened_path;
449 }
8f94a8a @edinkad First try to open php-SAPI.ini and if it fails fall back to regular
edinkad authored Jul 29, 2002
450 }
751cd67 get_cfg_var("get_file_path") didn't work correctly when an alternative
Sander Roobol authored May 19, 2002
451 }
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
452
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
453 if (free_ini_search_path) {
454 efree(php_ini_search_path);
455 }
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
456
42c82bb Revert the last patches.
foobar authored May 9, 2002
457 PG(safe_mode) = safe_mode_state;
458 PG(open_basedir) = open_basedir;
459
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
460 if (fh.handle.fp) {
461 fh.type = ZEND_HANDLE_FP;
42c82bb Revert the last patches.
foobar authored May 9, 2002
462
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
463 zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
464
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
465 {
466 zval tmp;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
467
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
468 Z_STRLEN(tmp) = strlen(fh.filename);
469 Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRLEN(tmp));
470 Z_TYPE(tmp) = IS_STRING;
471 zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"), (void *) &tmp, sizeof(zval), NULL);
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
472 if (php_ini_opened_path) {
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
473 efree(php_ini_opened_path);
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
474 }
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
475 php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
476 }
cecb9df Implemented -n switch to skip parsing ini at startup as suggested by …
Marcus Boerger authored Nov 12, 2002
477 }
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
478
479 /* If the config_file_scan_dir is set at compile-time, go and scan this directory and
480 * parse any .ini files found in this directory. */
173b949 Fixed bug: #22011 (-n must ignore all ini files)
foobar authored Feb 3, 2003
481 if (!sapi_module.php_ini_ignore && strlen(PHP_CONFIG_FILE_SCAN_DIR)) {
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored Jan 25, 2003
482 struct dirent **namelist;
483 int ndir, i;
484
ec11fe0 Fix the possible conflicts with other libs (like libc-client)
foobar authored Feb 19, 2003
485 if ((ndir = php_scandir(PHP_CONFIG_FILE_SCAN_DIR, &namelist, 0, php_alphasort)) > 0) {
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored Jan 25, 2003
486 for (i = 0; i < ndir; i++) {
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
487 /* check for a .ini extension */
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored Jan 25, 2003
488 if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
489 free(namelist[i]);
d454bec - Whitespace
Derick Rethans authored Dec 30, 2002
490 continue;
491 }
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored Jan 25, 2003
492 snprintf(ini_file, MAXPATHLEN, "%s%c%s", PHP_CONFIG_FILE_SCAN_DIR, DEFAULT_SLASH, namelist[i]->d_name);
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
493 if (VCWD_STAT(ini_file, &sb) == 0) {
494 if (S_ISREG(sb.st_mode)) {
495 if ((fh.handle.fp = VCWD_FOPEN(ini_file, "r"))) {
496 fh.filename = ini_file;
1ad304c @rlerdorf MFB config-file-scan-dir crash fix
rlerdorf authored Feb 28, 2003
497 fh.type = ZEND_HANDLE_FP;
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
498 zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
499 /* Here, add it to the list of ini files read */
500 l = strlen(ini_file);
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
501 total_l += l + 2;
502 p = estrndup(ini_file, l);
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
503 zend_llist_add_element(&scanned_ini_list, &p);
504 }
505 }
506 }
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored Jan 25, 2003
507 free(namelist[i]);
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
508 }
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored Jan 25, 2003
509 free(namelist);
510
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
511 /*
512 * Don't need an extra byte for the \0 in this malloc as the last
513 * element will not get a trailing , which gives us the byte for the \0
514 */
3781af5 - Fixed zero bytes memory allocation when no extra ini files are foun…
Derick Rethans authored Feb 14, 2004
515 if (total_l) {
516 php_ini_scanned_files = (char *) malloc(total_l);
517 *php_ini_scanned_files = '\0';
518 for (element = scanned_ini_list.head; element; element = element->next) {
519 strcat(php_ini_scanned_files, *(char **)element->data);
520 strcat(php_ini_scanned_files, element->next ? ",\n" : "\n");
521 }
522 }
ac9f4cc - We always need to destroy the llist though.
Derick Rethans authored Feb 14, 2004
523 zend_llist_destroy(&scanned_ini_list);
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
524 }
42c82bb Revert the last patches.
foobar authored May 9, 2002
525 }
526 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
527 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
528 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
529
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
530 /* {{{ php_shutdown_config
531 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
532 int php_shutdown_config(void)
533 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
534 zend_hash_destroy(&configuration_hash);
535 if (php_ini_opened_path) {
536 free(php_ini_opened_path);
2a2d49b Fixed bug #30050 (Possible crash inside php_shutdown_config()).
Ilia Alshanetsky authored Sep 17, 2004
537 php_ini_opened_path = NULL;
42c82bb Revert the last patches.
foobar authored May 9, 2002
538 }
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
539 if (php_ini_scanned_files) {
540 free(php_ini_scanned_files);
2a2d49b Fixed bug #30050 (Possible crash inside php_shutdown_config()).
Ilia Alshanetsky authored Sep 17, 2004
541 php_ini_scanned_files = NULL;
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored Oct 4, 2002
542 }
42c82bb Revert the last patches.
foobar authored May 9, 2002
543 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
544 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
545 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
546
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
547 /* {{{ php_ini_delayed_modules_startup
548 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
549 void php_ini_delayed_modules_startup(TSRMLS_D)
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
550 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
551 zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb TSRMLS_CC);
552 zend_llist_apply(&extension_lists.functions, php_load_function_extension_cb TSRMLS_CC);
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
553
42c82bb Revert the last patches.
foobar authored May 9, 2002
554 zend_llist_destroy(&extension_lists.engine);
555 zend_llist_destroy(&extension_lists.functions);
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
556 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
557 /* }}} */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
558
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
559 /* {{{ cfg_get_entry
560 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
561 zval *cfg_get_entry(char *name, uint name_length)
562 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
563 zval *tmp;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
564
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
565 if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp) == SUCCESS) {
42c82bb Revert the last patches.
foobar authored May 9, 2002
566 return tmp;
567 } else {
568 return NULL;
569 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
570 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
571 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
572
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
573 /* {{{ cfg_get_long
574 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
575 PHPAPI int cfg_get_long(char *varname, long *result)
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
576 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
577 zval *tmp, var;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
578
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
579 if (zend_hash_find(&configuration_hash, varname, strlen(varname) + 1, (void **) &tmp) == FAILURE) {
580 *result = (long) NULL;
42c82bb Revert the last patches.
foobar authored May 9, 2002
581 return FAILURE;
582 }
583 var = *tmp;
584 zval_copy_ctor(&var);
585 convert_to_long(&var);
586 *result = Z_LVAL(var);
587 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
588 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
589 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
590
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
591 /* {{{ cfg_get_double
592 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
593 PHPAPI int cfg_get_double(char *varname, double *result)
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
594 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
595 zval *tmp, var;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored May 11, 2002
596
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
597 if (zend_hash_find(&configuration_hash, varname, strlen(varname) + 1, (void **) &tmp) == FAILURE) {
598 *result = (double) 0;
42c82bb Revert the last patches.
foobar authored May 9, 2002
599 return FAILURE;
600 }
601 var = *tmp;
602 zval_copy_ctor(&var);
603 convert_to_double(&var);
604 *result = Z_DVAL(var);
605 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
606 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
607 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
608
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
609 /* {{{ cfg_get_string
610 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
611 PHPAPI int cfg_get_string(char *varname, char **result)
612 {
42c82bb Revert the last patches.
foobar authored May 9, 2002
613 zval *tmp;
614
7e3b508 ws/style fixes
foobar authored Feb 19, 2003
615 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp) == FAILURE) {
616 *result = NULL;
42c82bb Revert the last patches.
foobar authored May 9, 2002
617 return FAILURE;
618 }
619 *result = Z_STRVAL_P(tmp);
620 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
621 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
622 /* }}} */
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored Apr 22, 2001
623
624 /*
625 * Local variables:
626 * tab-width: 4
627 * c-basic-offset: 4
628 * indent-tabs-mode: t
629 * End:
78747bd - Don't wrap lines... this is annoying while coding.
Derick Rethans authored Sep 9, 2001
630 * vim600: sw=4 ts=4 fdm=marker
631 * vim<600: sw=4 ts=4
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored Apr 22, 2001
632 */
Something went wrong with that request. Please try again.