Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 633 lines (562 sloc) 17.31 kB
651e232 @zsuraski Testing 123
zsuraski authored
1 /*
2 +----------------------------------------------------------------------+
dbeb415 @andigutmans - A belated happy holidays and PHP 5
andigutmans authored
3 | PHP Version 5 |
651e232 @zsuraski Testing 123
zsuraski authored
4 +----------------------------------------------------------------------+
dbeb415 @andigutmans - A belated happy holidays and PHP 5
andigutmans authored
5 | Copyright (c) 1997-2004 The PHP Group |
651e232 @zsuraski Testing 123
zsuraski authored
6 +----------------------------------------------------------------------+
f68c7ff updating license information in the headers.
James Cox authored
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
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
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
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
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
14 +----------------------------------------------------------------------+
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored
15 | Author: Zeev Suraski <zeev@zend.com> |
651e232 @zsuraski Testing 123
zsuraski authored
16 +----------------------------------------------------------------------+
17 */
18
46a7b0c @fmk Killing compiler warning on Win32
fmk authored
19 /* $Id$ */
651e232 @zsuraski Testing 123
zsuraski authored
20
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
21 /* Check CWD for php.ini */
22 #define INI_CHECK_CWD
23
aceaabc @zsuraski PHP 4.0
zsuraski authored
24 #include "php.h"
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
25 #include "ext/standard/info.h"
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
26 #include "zend_ini.h"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
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
30 #include "zend_highlight.h"
ab25640 Removed CWD from php_ini_search_path when using CLI SAPI.
Edin Kadribasic authored
31 #include "SAPI.h"
46a7b0c @fmk Killing compiler warning on Win32
fmk authored
32 #include "php_main.h"
ec11fe0 Fix the possible conflicts with other libs (like libc-client)
foobar authored
33 #include "php_scandir.h"
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored
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, p…
zsuraski authored
37
ec11fe0 Fix the possible conflicts with other libs (like libc-client)
foobar authored
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
40 #endif
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored
41
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
46 typedef struct _php_extension_lists {
42c82bb Revert the last patches.
foobar authored
47 zend_llist engine;
48 zend_llist functions;
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
49 } php_extension_lists;
58e24ac @zsuraski - Add PHP Modules workspace
zsuraski authored
50
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
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
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
57
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
58 /* {{{ php_ini_displayer_cb
59 */
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
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
61 {
42c82bb Revert the last patches.
foobar authored
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
69 if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
42c82bb Revert the last patches.
foobar authored
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
73 esc_html = !sapi_module.phpinfo_as_text;
42c82bb Revert the last patches.
foobar authored
74 } else {
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored
75 if (!sapi_module.phpinfo_as_text) {
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored
76 display_string = "<i>no value</i>";
7e3b508 ws/style fixes
foobar authored
77 display_string_length = sizeof("<i>no value</i>") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored
78 } else {
79 display_string = "no value";
7e3b508 ws/style fixes
foobar authored
80 display_string_length = sizeof("no value") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored
81 }
42c82bb Revert the last patches.
foobar authored
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
86 esc_html = !sapi_module.phpinfo_as_text;
42c82bb Revert the last patches.
foobar authored
87 } else {
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored
88 if (!sapi_module.phpinfo_as_text) {
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored
89 display_string = "<i>no value</i>";
7e3b508 ws/style fixes
foobar authored
90 display_string_length = sizeof("<i>no value</i>") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored
91 } else {
92 display_string = "no value";
7e3b508 ws/style fixes
foobar authored
93 display_string_length = sizeof("no value") - 1;
d6497fc - reenable "no value" output. thanks to sebastian for pointing that …
Jan Lehnardt authored
94 }
42c82bb Revert the last patches.
foobar authored
95 }
7e3b508 ws/style fixes
foobar authored
96
97 if (esc_html) {
a769454 reenable php_html_puts
Sascha Schumann authored
98 php_html_puts(display_string, display_string_length TSRMLS_CC);
42c82bb Revert the last patches.
foobar authored
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
103 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
104 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
105
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
106 /* {{{ php_ini_displayer
107 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
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
109 {
42c82bb Revert the last patches.
foobar authored
110 if (ini_entry->module_number != module_number) {
111 return 0;
112 }
b5c97d8 fix phpinfo() & php -i
Marcus Boerger authored
113 if (!sapi_module.phpinfo_as_text) {
14a6cc8 Change phpinfo() to use CSS styling instead of HTML code.
Colin Viebrock authored
114 PUTS("<tr>");
c7c275b fix phpinfo() output for better browser BC
Colin Viebrock authored
115 PUTS("<td class=\"e\">");
7e3b508 ws/style fixes
foobar authored
116 PHPWRITE(ini_entry->name, ini_entry->name_length - 1);
c7c275b fix phpinfo() output for better browser BC
Colin Viebrock authored
117 PUTS("</td><td class=\"v\">");
6676617 - add phpinfo() support for CLI.
Jan Lehnardt authored
118 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
c7c275b fix phpinfo() output for better browser BC
Colin Viebrock authored
119 PUTS("</td><td class=\"v\">");
6676617 - add phpinfo() support for CLI.
Jan Lehnardt authored
120 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
121 PUTS("</td></tr>\n");
122 } else {
7e3b508 ws/style fixes
foobar authored
123 PHPWRITE(ini_entry->name, ini_entry->name_length - 1);
6676617 - add phpinfo() support for CLI.
Jan Lehnardt authored
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
130 return 0;
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
131 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
132 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
133
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
134 /* {{{ display_ini_entries
135 */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
136 PHPAPI void display_ini_entries(zend_module_entry *module)
137 {
42c82bb Revert the last patches.
foobar authored
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
143 } else {
42c82bb Revert the last patches.
foobar authored
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
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
149 php_info_print_table_end();
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
150 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
151 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
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
157 # define ZEND_EXTENSION_TOKEN "zend_extension_debug_ts"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
158 # else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
159 # define ZEND_EXTENSION_TOKEN "zend_extension_ts"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
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
163 # define ZEND_EXTENSION_TOKEN "zend_extension_debug"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
164 # else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
165 # define ZEND_EXTENSION_TOKEN "zend_extension"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
166 # endif
167 #endif
168
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
169 /* {{{ pvalue_config_destructor
170 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
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
172 {
56f8195 @andigutmans - Nuke empty_string. It is a reminanent from the time where RETURN_FA…
andigutmans authored
173 if (Z_TYPE_P(pvalue) == IS_STRING) {
7e3b508 ws/style fixes
foobar authored
174 free(Z_STRVAL_P(pvalue));
175 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
176 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
177 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
178
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
179 /* {{{ php_config_ini_parser_cb
180 */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
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, p…
zsuraski authored
182 {
42c82bb Revert the last patches.
foobar authored
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
192
42c82bb Revert the last patches.
foobar authored
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
196 zend_llist_add_element(&extension_lists.functions, &copy);
42c82bb Revert the last patches.
foobar authored
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
199
42c82bb Revert the last patches.
foobar authored
200 zend_llist_add_element(&extension_lists.engine, &extension_name);
201 } else {
7e3b508 ws/style fixes
foobar authored
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
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
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
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
219 ALLOC_ZVAL(hash);
220 array_init(hash);
221
7e3b508 ws/style fixes
foobar authored
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
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
235 case ZEND_INI_PARSER_SECTION:
236 break;
237 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
238 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
239 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
240
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
241 /* {{{ php_load_function_extension_cb
242 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
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
244 {
42c82bb Revert the last patches.
foobar authored
245 zval *extension = (zval *) arg;
246 zval zval;
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored
247
42c82bb Revert the last patches.
foobar authored
248 php_dl(extension, MODULE_PERSISTENT, &zval TSRMLS_CC);
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
249 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
250 /* }}} */
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
251
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
252 /* {{{ php_load_zend_extension_cb
253 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
254 static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
255 {
42c82bb Revert the last patches.
foobar authored
256 zend_load_extension(*((char **) arg));
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored
257 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
258 /* }}} */
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored
259
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
260 /* {{{ php_init_config
261 */
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
262 int php_init_config()
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
263 {
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
264 char *env_location, *php_ini_search_path;
265 char *binary_location;
42c82bb Revert the last patches.
foobar authored
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
268 int free_ini_search_path=0;
42c82bb Revert the last patches.
foobar authored
269 zend_file_handle fh;
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
276 TSRMLS_FETCH();
277
7e3b508 ws/style fixes
foobar authored
278 if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1) == FAILURE) {
42c82bb Revert the last patches.
foobar authored
279 return FAILURE;
280 }
281
63739c7 give sapi modules the possibility to overwrite default ini settings
Marcus Boerger authored
282 if (sapi_module.ini_defaults) {
283 sapi_module.ini_defaults(&configuration_hash);
284 }
285
42c82bb Revert the last patches.
foobar authored
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
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
289
42c82bb Revert the last patches.
foobar authored
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
293 env_location = getenv("PHPRC");
294 if (!env_location) {
7e3b508 ws/style fixes
foobar authored
295 env_location = "";
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
296 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
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
302 static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
2479384 Fixed unused variable warning on *nix.
Ilia Alshanetsky authored
303 #ifdef PHP_WIN32
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored
304 char *reg_location;
2479384 Fixed unused variable warning on *nix.
Ilia Alshanetsky authored
305 #endif
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
306
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored
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
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
310
06aae4b @smalyshev Enable setting php.ini path via the registry
smalyshev authored
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
322 /*
323 * Prepare search path
324 */
42c82bb Revert the last patches.
foobar authored
325
2629613 Fix PHPRC overriding other ini files. This is how PHPRC worked prior to
Shane Caraveo authored
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
334 /* Add cwd */
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
335 #ifdef INI_CHECK_CWD
7e3b508 ws/style fixes
foobar authored
336 if (strcmp(sapi_module.name, "cli") != 0) {
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored
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
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
342 #endif
42c82bb Revert the last patches.
foobar authored
343
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
344 /* Add binary directory */
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
345 #ifdef PHP_WIN32
b9fd107 @zsuraski Use portable #define
zsuraski authored
346 binary_location = (char *) emalloc(MAXPATHLEN);
7e3b508 ws/style fixes
foobar authored
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
348 efree(binary_location);
349 binary_location = NULL;
42c82bb Revert the last patches.
foobar authored
350 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
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
356 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
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
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
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
373 default_location = (char *) emalloc(MAXPATHLEN + 1);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
374
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored
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
380 }
381 efree(default_location);
fcdda2e @wez Fix a problem resolving the php.ini path under win32 terminal service…
wez authored
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
408 #else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
409 default_location = PHP_CONFIG_FILE_PATH;
e1658ed Minor cleanups to path building and php*.ini search logic.
Preston L. Bannister authored
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
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
414 #endif
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
415 }
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
416
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
417 PG(safe_mode) = 0;
418 PG(open_basedir) = NULL;
419
e52aac9 @wez Implement simple stream support in the ZE scanners.
wez authored
420 memset(&fh, 0, sizeof(fh));
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
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
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
431 }
432 }
cecb9df Implemented -n switch to skip parsing ini at startup as suggested by …
Marcus Boerger authored
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
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
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
443 }
cecb9df Implemented -n switch to skip parsing ini at startup as suggested by …
Marcus Boerger authored
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 First try to open php-SAPI.ini and if it fails fall back to regular
Edin Kadribasic authored
450 }
751cd67 get_cfg_var("get_file_path") didn't work correctly when an alternative
Sander Roobol authored
451 }
7e3b508 ws/style fixes
foobar authored
452
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
453 if (free_ini_search_path) {
454 efree(php_ini_search_path);
455 }
7e3b508 ws/style fixes
foobar authored
456
42c82bb Revert the last patches.
foobar authored
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
460 if (fh.handle.fp) {
461 fh.type = ZEND_HANDLE_FP;
42c82bb Revert the last patches.
foobar authored
462
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
464
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
465 {
466 zval tmp;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
467
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
472 if (php_ini_opened_path) {
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
473 efree(php_ini_opened_path);
7e3b508 ws/style fixes
foobar authored
474 }
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
477 }
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
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
482 struct dirent **namelist;
483 int ndir, i;
484
ec11fe0 Fix the possible conflicts with other libs (like libc-client)
foobar authored
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
486 for (i = 0; i < ndir; i++) {
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
487 /* check for a .ini extension */
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored
488 if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
489 free(namelist[i]);
d454bec - Whitespace
Derick Rethans authored
490 continue;
491 }
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored
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
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
497 fh.type = ZEND_HANDLE_FP;
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
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
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
507 free(namelist[i]);
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
508 }
8d352d2 Fixed bug #21625 (When scanning a directory for ini files, do so in
Ilia Alshanetsky authored
509 free(namelist);
510
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
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
523 zend_llist_destroy(&scanned_ini_list);
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
524 }
42c82bb Revert the last patches.
foobar authored
525 }
526 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
527 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
528 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
529
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
530 /* {{{ php_shutdown_config
531 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
532 int php_shutdown_config(void)
533 {
42c82bb Revert the last patches.
foobar authored
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
537 php_ini_opened_path = NULL;
42c82bb Revert the last patches.
foobar authored
538 }
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
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
541 php_ini_scanned_files = NULL;
989a61e @rlerdorf As discussed, add --with-config-file-scan-dir compile-time switch def…
rlerdorf authored
542 }
42c82bb Revert the last patches.
foobar authored
543 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
544 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
545 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
546
f47c784 Improved PHP extension loading mechanism with support for module depe…
Dmitry Stogov authored
547 /* {{{ php_ini_register_extensions
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
548 */
f47c784 Improved PHP extension loading mechanism with support for module depe…
Dmitry Stogov authored
549 void php_ini_register_extensions(TSRMLS_D)
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
550 {
42c82bb Revert the last patches.
foobar authored
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
553
42c82bb Revert the last patches.
foobar authored
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
556 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
557 /* }}} */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
558
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
559 /* {{{ cfg_get_entry
560 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
561 zval *cfg_get_entry(char *name, uint name_length)
562 {
42c82bb Revert the last patches.
foobar authored
563 zval *tmp;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
564
7e3b508 ws/style fixes
foobar authored
565 if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp) == SUCCESS) {
42c82bb Revert the last patches.
foobar authored
566 return tmp;
567 } else {
568 return NULL;
569 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
570 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
571 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
572
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
573 /* {{{ cfg_get_long
574 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored
575 PHPAPI int cfg_get_long(char *varname, long *result)
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
576 {
42c82bb Revert the last patches.
foobar authored
577 zval *tmp, var;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
578
7e3b508 ws/style fixes
foobar authored
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
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, p…
zsuraski authored
588 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
589 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
590
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
591 /* {{{ cfg_get_double
592 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored
593 PHPAPI int cfg_get_double(char *varname, double *result)
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
594 {
42c82bb Revert the last patches.
foobar authored
595 zval *tmp, var;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
596
7e3b508 ws/style fixes
foobar authored
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
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, p…
zsuraski authored
606 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
607 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
608
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
609 /* {{{ cfg_get_string
610 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
611 PHPAPI int cfg_get_string(char *varname, char **result)
612 {
42c82bb Revert the last patches.
foobar authored
613 zval *tmp;
614
7e3b508 ws/style fixes
foobar authored
615 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp) == FAILURE) {
616 *result = NULL;
42c82bb Revert the last patches.
foobar authored
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, p…
zsuraski authored
621 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
622 /* }}} */
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored
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
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
632 */
Something went wrong with that request. Please try again.