Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 442 lines (386 sloc) 11.647 kB
651e232 @zsuraski Testing 123
zsuraski authored
1 /*
2 +----------------------------------------------------------------------+
3893351 Update headers.
Sebastian Bergmann authored
3 | PHP Version 4 |
651e232 @zsuraski Testing 123
zsuraski authored
4 +----------------------------------------------------------------------+
3893351 Update headers.
Sebastian Bergmann authored
5 | Copyright (c) 1997-2002 The PHP Group |
651e232 @zsuraski Testing 123
zsuraski authored
6 +----------------------------------------------------------------------+
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored
7 | This source file is subject to version 2.02 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available at through the world-wide-web at |
10 | http://www.php.net/license/2_02.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"
0be5cca @fmk Fix build on WIn32
fmk authored
25 #ifndef PHP_WIN32
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored
26 #include "build-defs.h"
0be5cca @fmk Fix build on WIn32
fmk authored
27 #endif
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
28 #include "ext/standard/info.h"
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
29 #include "zend_ini.h"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
30 #include "php_ini.h"
31 #include "ext/standard/dl.h"
32 #include "zend_extensions.h"
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored
33 #include "zend_highlight.h"
ab25640 Removed CWD from php_ini_search_path when using CLI SAPI.
Edin Kadribasic authored
34 #include "SAPI.h"
46a7b0c @fmk Killing compiler warning on Win32
fmk authored
35 #include "php_main.h"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
36
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
37 typedef struct _php_extension_lists {
42c82bb Revert the last patches.
foobar authored
38 zend_llist engine;
39 zend_llist functions;
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
40 } php_extension_lists;
58e24ac @zsuraski - Add PHP Modules workspace
zsuraski authored
41
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
42
43 /* True globals */
44 static HashTable configuration_hash;
45 PHPAPI char *php_ini_opened_path=NULL;
46 static php_extension_lists extension_lists;
47
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
48 /* {{{ php_ini_displayer_cb
49 */
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
50 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
51 {
42c82bb Revert the last patches.
foobar authored
52 if (ini_entry->displayer) {
53 ini_entry->displayer(ini_entry, type);
54 } else {
55 char *display_string;
56 uint display_string_length, esc_html=0;
57 TSRMLS_FETCH();
58
59 if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
60 if (ini_entry->orig_value && ini_entry->orig_value[0]) {
61 display_string = ini_entry->orig_value;
62 display_string_length = ini_entry->orig_value_length;
63 esc_html=1;
64 } else {
65 display_string = "<i>no value</i>";
66 display_string_length = sizeof("<i>no value</i>")-1;
67 }
68 } else if (ini_entry->value && ini_entry->value[0]) {
69 display_string = ini_entry->value;
70 display_string_length = ini_entry->value_length;
71 esc_html=1;
72 } else {
73 display_string = "<i>no value</i>";
74 display_string_length = sizeof("<i>no value</i>")-1;
75 }
76 if(esc_html) {
a769454 reenable php_html_puts
Sascha Schumann authored
77 php_html_puts(display_string, display_string_length TSRMLS_CC);
42c82bb Revert the last patches.
foobar authored
78 } else {
79 PHPWRITE(display_string, display_string_length);
80 }
81 }
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
82 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
83 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
84
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
85 /* {{{ php_ini_displayer
86 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
87 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
88 {
42c82bb Revert the last patches.
foobar authored
89 if (ini_entry->module_number != module_number) {
90 return 0;
91 }
92
93 PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
94 PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>");
95 PHPWRITE(ini_entry->name, ini_entry->name_length-1);
96 PUTS("</b><br /></td><td align=\"center\">");
97 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
98 PUTS("</td><td align=\"center\">");
99 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
100 PUTS("</td></tr>\n");
101 return 0;
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
102 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
103 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
104
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
105 /* {{{ display_ini_entries
106 */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
107 PHPAPI void display_ini_entries(zend_module_entry *module)
108 {
42c82bb Revert the last patches.
foobar authored
109 int module_number;
110 TSRMLS_FETCH();
111
112 if (module) {
113 module_number = module->module_number;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
114 } else {
42c82bb Revert the last patches.
foobar authored
115 module_number = 0;
116 }
117 php_info_print_table_start();
118 php_info_print_table_header(3, "Directive", "Local Value", "Master Value");
119 zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (long) module_number TSRMLS_CC);
120 php_info_print_table_end();
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among…
zsuraski authored
121 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
122 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
123
124 /* php.ini support */
125
126 #ifdef ZTS
127 # if (ZEND_DEBUG)
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
128 # 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
129 # else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
130 # define ZEND_EXTENSION_TOKEN "zend_extension_ts"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
131 # endif
132 #else
133 # if (ZEND_DEBUG)
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
134 # define ZEND_EXTENSION_TOKEN "zend_extension_debug"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
135 # else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
136 # define ZEND_EXTENSION_TOKEN "zend_extension"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
137 # endif
138 #endif
139
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
140 /* {{{ pvalue_config_destructor
141 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
142 static void pvalue_config_destructor(zval *pvalue)
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
143 {
144 if (Z_TYPE_P(pvalue) == IS_STRING && Z_STRVAL_P(pvalue) != empty_string) {
145 free(Z_STRVAL_P(pvalue));
146 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
147 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
148 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
149
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
150 /* {{{ php_config_ini_parser_cb
151 */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
152 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
153 {
42c82bb Revert the last patches.
foobar authored
154 switch (callback_type) {
155 case ZEND_INI_PARSER_ENTRY: {
156 zval *entry;
157
158 if (!arg2) {
159 break;
160 }
161 if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */
162 zval copy;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
163
42c82bb Revert the last patches.
foobar authored
164 copy = *arg2;
165 zval_copy_ctor(&copy);
166 copy.refcount = 0;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
167 zend_llist_add_element(&extension_lists.functions, &copy);
42c82bb Revert the last patches.
foobar authored
168 } else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
169 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
170
42c82bb Revert the last patches.
foobar authored
171 zend_llist_add_element(&extension_lists.engine, &extension_name);
172 } else {
173 zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, arg2, sizeof(zval), (void **) &entry);
174 Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
175 }
176 }
177 break;
178 case ZEND_INI_PARSER_SECTION:
179 break;
180 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
181 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
182 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
183
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
184 /* {{{ php_load_function_extension_cb
185 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
186 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
187 {
42c82bb Revert the last patches.
foobar authored
188 zval *extension = (zval *) arg;
189 zval zval;
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored
190
42c82bb Revert the last patches.
foobar authored
191 php_dl(extension, MODULE_PERSISTENT, &zval TSRMLS_CC);
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
192 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
193 /* }}} */
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
194
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
195 /* {{{ php_load_zend_extension_cb
196 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
197 static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored
198 {
42c82bb Revert the last patches.
foobar authored
199 zend_load_extension(*((char **) arg));
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored
200 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
201 /* }}} */
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored
202
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
203 /* {{{ php_init_config
204 */
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
205 int php_init_config()
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
206 {
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
207 char *env_location, *php_ini_search_path;
208 char *binary_location;
42c82bb Revert the last patches.
foobar authored
209 int safe_mode_state;
210 char *open_basedir;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
211 int free_ini_search_path=0;
42c82bb Revert the last patches.
foobar authored
212 zend_file_handle fh;
213 TSRMLS_FETCH();
214
215 if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1)==FAILURE) {
216 return FAILURE;
217 }
218
219 zend_llist_init(&extension_lists.engine, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
220 zend_llist_init(&extension_lists.functions, sizeof(zval), (llist_dtor_func_t) ZVAL_DESTRUCTOR, 1);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
221
42c82bb Revert the last patches.
foobar authored
222 safe_mode_state = PG(safe_mode);
223 open_basedir = PG(open_basedir);
224
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
225 env_location = getenv("PHPRC");
226 if (!env_location) {
227 env_location="";
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
228 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
229 if (sapi_module.php_ini_path_override) {
230 php_ini_search_path = sapi_module.php_ini_path_override;
231 free_ini_search_path = 0;
232 } else {
233 char *default_location;
234 char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
235
b9fd107 @zsuraski Use portable #define
zsuraski authored
236 php_ini_search_path = (char *) emalloc(MAXPATHLEN*3+strlen(env_location)+3+1);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
237 free_ini_search_path = 1;
238 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
239
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
240 /*
241 * Prepare search path
242 */
42c82bb Revert the last patches.
foobar authored
243
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
244 /* Add cwd */
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
245 #ifdef INI_CHECK_CWD
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
246 if (strcmp(sapi_module.name, "cli")!=0) {
247 strcat(php_ini_search_path, ".");
248 strcat(php_ini_search_path, paths_separator);
249 }
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
250 #endif
42c82bb Revert the last patches.
foobar authored
251
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
252 /* Add binary directory */
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
253 #ifdef PHP_WIN32
b9fd107 @zsuraski Use portable #define
zsuraski authored
254 binary_location = (char *) emalloc(MAXPATHLEN);
255 if (GetModuleFileName(0, binary_location, MAXPATHLEN)==0) {
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
256 efree(binary_location);
257 binary_location = NULL;
42c82bb Revert the last patches.
foobar authored
258 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
259 #else
260 if (sapi_module.executable_location) {
261 binary_location = estrdup(sapi_module.executable_location);
262 } else {
263 binary_location = NULL;
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
264 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
265 #endif
266 if (binary_location) {
267 char *separator_location = strrchr(binary_location, DEFAULT_SLASH);
268
269 if (separator_location) {
270 *(separator_location+1) = 0;
271 }
272 strcat(php_ini_search_path, binary_location);
273 strcat(php_ini_search_path, paths_separator);
274 efree(binary_location);
275 }
276
277 /* Add environment location */
278 if (env_location[0]) {
279 strcat(php_ini_search_path, env_location);
280 strcat(php_ini_search_path, paths_separator);
281 }
282
283 /* Add default location */
284 #ifdef PHP_WIN32
b9fd107 @zsuraski Use portable #define
zsuraski authored
285 default_location = (char *) emalloc(MAXPATHLEN+1);
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
286
b9fd107 @zsuraski Use portable #define
zsuraski authored
287 if (!GetWindowsDirectory(default_location, MAXPATHLEN)) {
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
288 default_location[0]=0;
289 }
290 strcat(php_ini_search_path, default_location);
291 efree(default_location);
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
292 #else
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
293 default_location = PHP_CONFIG_FILE_PATH;
294 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
295 #endif
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
296 }
6de4f3a Add check for php.ini in same directory as php.exe (or equivalent exe…
Preston L. Bannister authored
297
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
298 PG(safe_mode) = 0;
299 PG(open_basedir) = NULL;
300
301 fh.handle.fp = NULL;
302 /* Check if php_ini_path_override is a file */
303 if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) {
304 struct stat statbuf;
305
306 if (!VCWD_STAT(sapi_module.php_ini_path_override, &statbuf)) {
307 if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
308 fh.handle.fp = VCWD_FOPEN(sapi_module.php_ini_path_override, "r");
309 }
310 }
311 }
312 /* Search php.ini file in search path */
313 if (!fh.handle.fp)
314 fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
315 if (free_ini_search_path) {
316 efree(php_ini_search_path);
317 }
42c82bb Revert the last patches.
foobar authored
318 PG(safe_mode) = safe_mode_state;
319 PG(open_basedir) = open_basedir;
320
321 if (!fh.handle.fp) {
322 return SUCCESS; /* having no configuration file is ok */
323 }
324 fh.type = ZEND_HANDLE_FP;
325 fh.filename = php_ini_opened_path;
326
327 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
328
42c82bb Revert the last patches.
foobar authored
329 if (php_ini_opened_path) {
330 zval tmp;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
331
42c82bb Revert the last patches.
foobar authored
332 Z_STRLEN(tmp) = strlen(php_ini_opened_path);
333 Z_STRVAL(tmp) = zend_strndup(php_ini_opened_path, Z_STRLEN(tmp));
334 Z_TYPE(tmp) = IS_STRING;
335 zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"), (void *) &tmp, sizeof(zval), NULL);
336 efree(php_ini_opened_path);
337 php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
338 }
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
339
42c82bb Revert the last patches.
foobar authored
340 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
341 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
342 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
343
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
344 /* {{{ php_shutdown_config
345 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
346 int php_shutdown_config(void)
347 {
42c82bb Revert the last patches.
foobar authored
348 zend_hash_destroy(&configuration_hash);
349 if (php_ini_opened_path) {
350 free(php_ini_opened_path);
351 }
352 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
353 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
354 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
355
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
356 /* {{{ php_ini_delayed_modules_startup
357 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
358 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
359 {
42c82bb Revert the last patches.
foobar authored
360 zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb TSRMLS_CC);
361 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
362
42c82bb Revert the last patches.
foobar authored
363 zend_llist_destroy(&extension_lists.engine);
364 zend_llist_destroy(&extension_lists.functions);
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
365 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
366 /* }}} */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored
367
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
368 /* {{{ cfg_get_entry
369 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
370 zval *cfg_get_entry(char *name, uint name_length)
371 {
42c82bb Revert the last patches.
foobar authored
372 zval *tmp;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
373
42c82bb Revert the last patches.
foobar authored
374 if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) {
375 return tmp;
376 } else {
377 return NULL;
378 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
379 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
380 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
381
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
382 /* {{{ cfg_get_long
383 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored
384 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
385 {
42c82bb Revert the last patches.
foobar authored
386 zval *tmp, var;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
387
42c82bb Revert the last patches.
foobar authored
388 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp)==FAILURE) {
389 *result=(long)NULL;
390 return FAILURE;
391 }
392 var = *tmp;
393 zval_copy_ctor(&var);
394 convert_to_long(&var);
395 *result = Z_LVAL(var);
396 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
397 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
398 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
399
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
400 /* {{{ cfg_get_double
401 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored
402 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
403 {
42c82bb Revert the last patches.
foobar authored
404 zval *tmp, var;
5af649e @zsuraski Revert to the old php_ini.c, and reimplement the binary-path searching.
zsuraski authored
405
42c82bb Revert the last patches.
foobar authored
406 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp)==FAILURE) {
407 *result=(double)0;
408 return FAILURE;
409 }
410 var = *tmp;
411 zval_copy_ctor(&var);
412 convert_to_double(&var);
413 *result = Z_DVAL(var);
414 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
415 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
416 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
417
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
418 /* {{{ cfg_get_string
419 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
420 PHPAPI int cfg_get_string(char *varname, char **result)
421 {
42c82bb Revert the last patches.
foobar authored
422 zval *tmp;
423
424 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp)==FAILURE) {
425 *result=NULL;
426 return FAILURE;
427 }
428 *result = Z_STRVAL_P(tmp);
429 return SUCCESS;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, p…
zsuraski authored
430 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored
431 /* }}} */
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored
432
433 /*
434 * Local variables:
435 * tab-width: 4
436 * c-basic-offset: 4
437 * indent-tabs-mode: t
438 * End:
78747bd - Don't wrap lines... this is annoying while coding.
Derick Rethans authored
439 * vim600: sw=4 ts=4 fdm=marker
440 * vim<600: sw=4 ts=4
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored
441 */
Something went wrong with that request. Please try again.