Skip to content
Newer
Older
100644 392 lines (344 sloc) 10.3 KB
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
1 /*
2 +----------------------------------------------------------------------+
3893351 @sebastianbergmann Update headers.
sebastianbergmann authored Dec 11, 2001
3 | PHP Version 4 |
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
4 +----------------------------------------------------------------------+
3893351 @sebastianbergmann Update headers.
sebastianbergmann authored Dec 11, 2001
5 | Copyright (c) 1997-2002 The PHP Group |
651e232 @zsuraski Testing 123
zsuraski authored Apr 9, 1999
6 +----------------------------------------------------------------------+
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
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 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
19
aceaabc @zsuraski PHP 4.0
zsuraski authored Apr 7, 1999
20 #include "php.h"
0be5cca @fmk Fix build on WIn32
fmk authored Apr 23, 2001
21 #ifndef PHP_WIN32
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored Apr 22, 2001
22 #include "build-defs.h"
0be5cca @fmk Fix build on WIn32
fmk authored Apr 23, 2001
23 #endif
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
24 #include "ext/standard/info.h"
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
25 #include "zend_ini.h"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
26 #include "php_ini.h"
27 #include "ext/standard/dl.h"
28 #include "zend_extensions.h"
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
29 #include "zend_highlight.h"
ab25640 @edinkad Removed CWD from php_ini_search_path when using CLI SAPI.
edinkad authored Feb 28, 2002
30 #include "SAPI.h"
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
31
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
32 typedef struct _php_extension_lists {
33 zend_llist engine;
34 zend_llist functions;
35 } php_extension_lists;
58e24ac @zsuraski - Add PHP Modules workspace
zsuraski authored Aug 13, 1999
36
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
37
38 /* True globals */
39 static HashTable configuration_hash;
40 PHPAPI char *php_ini_opened_path=NULL;
41 static php_extension_lists extension_lists;
42
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
43 /* {{{ php_ini_displayer_cb
44 */
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
45 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
46 {
47 if (ini_entry->displayer) {
48 ini_entry->displayer(ini_entry, type);
49 } else {
50 char *display_string;
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
51 uint display_string_length, esc_html=0;
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
52
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
53 if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
2830e45 - Applied patch by Yasuo Ohgaki <yasuo_ohgaki@yahoo.com>
Derick Rethans authored Nov 1, 2001
54 if (ini_entry->orig_value && ini_entry->orig_value[0]) {
d62a739 @zsuraski More fixes. Should hopefully work well now.
zsuraski authored May 22, 1999
55 display_string = ini_entry->orig_value;
56 display_string_length = ini_entry->orig_value_length;
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
57 esc_html=1;
d62a739 @zsuraski More fixes. Should hopefully work well now.
zsuraski authored May 22, 1999
58 } else {
59 display_string = "<i>no value</i>";
60 display_string_length = sizeof("<i>no value</i>")-1;
61 }
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
62 } else if (ini_entry->value && ini_entry->value[0]) {
63 display_string = ini_entry->value;
64 display_string_length = ini_entry->value_length;
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
65 esc_html=1;
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
66 } else {
67 display_string = "<i>no value</i>";
68 display_string_length = sizeof("<i>no value</i>")-1;
69 }
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
70 if(esc_html) {
71 zend_html_puts(display_string, display_string_length);
72 } else {
373b3e1 more tsrm cleanup -- output.c is not doing any fetches anymore
Sascha Schumann authored Aug 5, 2001
73 TSRMLS_FETCH();
9d1817e Fix bug: #10323. Every value outputted is now escaped.
foobar authored May 6, 2001
74 PHPWRITE(display_string, display_string_length);
75 }
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
76 }
77 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
78 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
79
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
80 /* {{{ php_ini_displayer
81 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
82 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
83 {
84 if (ini_entry->module_number != module_number) {
85 return 0;
86 }
87
e4f109b Finish phpinfo() HTML 4.01 tweaking.
Sebastian Bergmann authored Jun 19, 2001
88 PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
89 PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>");
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
90 PHPWRITE(ini_entry->name, ini_entry->name_length-1);
a0bbfb5 - <br> -> <br />
Derick Rethans authored Oct 6, 2001
91 PUTS("</b><br /></td><td align=\"center\">");
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
92 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
e4f109b Finish phpinfo() HTML 4.01 tweaking.
Sebastian Bergmann authored Jun 19, 2001
93 PUTS("</td><td align=\"center\">");
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
94 php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
e4f109b Finish phpinfo() HTML 4.01 tweaking.
Sebastian Bergmann authored Jun 19, 2001
95 PUTS("</td></tr>\n");
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
96 return 0;
97 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
98 /* }}} */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
99
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
100 /* {{{ display_ini_entries
101 */
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
102 PHPAPI void display_ini_entries(zend_module_entry *module)
103 {
104 int module_number;
fe6f871 @zsuraski - Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored Jul 27, 2001
105 TSRMLS_FETCH();
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
106
107 if (module) {
108 module_number = module->module_number;
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored Oct 29, 2000
109 } else {
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
110 module_number = 0;
111 }
1ddc9ff Prettying up the output of phpinfo(). Someone has to tell me how
Colin Viebrock authored Apr 5, 2000
112 php_info_print_table_start();
ba88c0c @zsuraski * Move unclean_shutdown from PHP to Zend.
zsuraski authored May 11, 1999
113 php_info_print_table_header(3, "Directive", "Local Value", "Master Value");
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
114 zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (long) module_number TSRMLS_CC);
1ddc9ff Prettying up the output of phpinfo(). Someone has to tell me how
Colin Viebrock authored Apr 5, 2000
115 php_info_print_table_end();
bc415d5 @zsuraski * Finalizing the PHP version of SAPI. Support POST and cookies among …
zsuraski authored May 9, 1999
116 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
117 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
118
119 /* php.ini support */
120
121 #ifdef ZTS
122 # if (ZEND_DEBUG)
123 # define ZEND_EXTENSION_TOKEN "zend_extension_debug_ts"
124 # else
125 # define ZEND_EXTENSION_TOKEN "zend_extension_ts"
126 # endif
127 #else
128 # if (ZEND_DEBUG)
129 # define ZEND_EXTENSION_TOKEN "zend_extension_debug"
130 # else
131 # define ZEND_EXTENSION_TOKEN "zend_extension"
132 # endif
133 #endif
134
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
135 /* {{{ pvalue_config_destructor
136 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
137 static void pvalue_config_destructor(zval *pvalue)
138 {
c033288 Back-substitute for Z_* macro's. If it breaks some extension (the scr…
Jeroen van Wolffelaar authored Sep 25, 2001
139 if (Z_TYPE_P(pvalue) == IS_STRING && Z_STRVAL_P(pvalue) != empty_string) {
140 free(Z_STRVAL_P(pvalue));
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
141 }
142 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
143 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
144
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
145 /* {{{ php_config_ini_parser_cb
146 */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
147 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
148 {
149 switch (callback_type) {
150 case ZEND_INI_PARSER_ENTRY: {
151 zval *entry;
152
153 if (!arg2) {
154 break;
155 }
156 if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
157 zval copy;
158
159 copy = *arg2;
160 zval_copy_ctor(&copy);
161 copy.refcount = 0;
162 zend_llist_add_element(&extension_lists.functions, &copy);
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
163 } else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
164 char *extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
165
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
166 zend_llist_add_element(&extension_lists.engine, &extension_name);
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
167 } else {
168 zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, arg2, sizeof(zval), (void **) &entry);
169 Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
170 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
171 }
172 break;
173 case ZEND_INI_PARSER_SECTION:
174 break;
175 }
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_load_function_extension_cb
180 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
181 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
182 {
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
183 zval *extension = (zval *) arg;
184 zval zval;
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
185
001df0d Yet another TSRM fix.
foobar authored Aug 7, 2001
186 php_dl(extension, MODULE_PERSISTENT, &zval TSRMLS_CC);
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
187 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
188 /* }}} */
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
189
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
190 /* {{{ php_load_zend_extension_cb
191 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
192 static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
193 {
194 zend_load_extension(*((char **) arg));
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
195 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
196 /* }}} */
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
197
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
198 /* {{{ php_init_config
199 */
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
200 int php_init_config(char *php_ini_path_override)
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
201 {
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
202 char *env_location, *php_ini_search_path;
203 int safe_mode_state;
204 char *open_basedir;
205 int free_ini_search_path=0;
206 zend_file_handle fh;
d87cc97 @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored Jul 28, 2001
207 TSRMLS_FETCH();
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
208
209 if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1)==FAILURE) {
210 return FAILURE;
211 }
212
00ef031 @rlerdorf This is a list of char *'s, not zvals (caught by Nick - see bug #13107)
rlerdorf authored Sep 3, 2001
213 zend_llist_init(&extension_lists.engine, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
a6f90ec @andigutmans - Get rid of warning.
andigutmans authored Apr 21, 2001
214 zend_llist_init(&extension_lists.functions, sizeof(zval), (llist_dtor_func_t) ZVAL_DESTRUCTOR, 1);
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
215
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
216 safe_mode_state = PG(safe_mode);
217 open_basedir = PG(open_basedir);
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
218
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
219 env_location = getenv("PHPRC");
220 if (!env_location) {
221 env_location="";
222 }
223 if (php_ini_path_override) {
224 php_ini_search_path = php_ini_path_override;
225 free_ini_search_path = 0;
226 } else {
227 char *default_location;
228 int free_default_location;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
229
230 #ifdef PHP_WIN32
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
231 default_location = (char *) emalloc(512);
232
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
233 if (!GetWindowsDirectory(default_location, 255)) {
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
234 default_location[0]=0;
235 }
236 free_default_location=1;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
237 #else
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored Apr 22, 2001
238 default_location = PHP_CONFIG_FILE_PATH;
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
239 free_default_location=0;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
240 #endif
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
241 php_ini_search_path = (char *) emalloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
242 free_ini_search_path = 1;
ab25640 @edinkad Removed CWD from php_ini_search_path when using CLI SAPI.
edinkad authored Feb 28, 2002
243 if (strcmp(sapi_module.name, "cli")==0) {
244 if(env_location && env_location[0]) {
245 sprintf(php_ini_search_path, "%s%c%s", env_location, ZEND_PATHS_SEPARATOR, default_location);
246 } else {
247 sprintf(php_ini_search_path, "%s", default_location);
248 }
7c2ea02 @smalyshev Don't insert empty path if PHPRC is empty
smalyshev authored Mar 6, 2001
249 } else {
ab25640 @edinkad Removed CWD from php_ini_search_path when using CLI SAPI.
edinkad authored Feb 28, 2002
250 if(env_location && env_location[0]) {
251 sprintf(php_ini_search_path, ".%c%s%c%s", ZEND_PATHS_SEPARATOR, env_location, ZEND_PATHS_SEPARATOR, default_location);
252 } else {
253 sprintf(php_ini_search_path, ".%c%s", ZEND_PATHS_SEPARATOR, default_location);
254 }
7c2ea02 @smalyshev Don't insert empty path if PHPRC is empty
smalyshev authored Mar 6, 2001
255 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
256 if (free_default_location) {
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
257 efree(default_location);
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
258 }
259 }
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
260
261 PG(safe_mode) = 0;
262 PG(open_basedir) = NULL;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
263
b1de7fc @zsuraski More TSRMLS_FETCH annihilation. Enough for today...
zsuraski authored Jul 31, 2001
264 fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
265 if (free_ini_search_path) {
266 efree(php_ini_search_path);
267 }
268 PG(safe_mode) = safe_mode_state;
269 PG(open_basedir) = open_basedir;
270
271 if (!fh.handle.fp) {
272 return SUCCESS; /* having no configuration file is ok */
273 }
b91a666 Z_TYPE(filehandle)?? ok.. whatever... ;)
Sterling Hughes authored Nov 26, 2001
274 fh.type = ZEND_HANDLE_FP;
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
275 fh.filename = php_ini_opened_path;
276
d294f46 @zsuraski - Remove the ini_extension_list global
zsuraski authored Jan 15, 2001
277 zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
db0b8bc Defer loading of extensions until all configuration entries have been
Sascha Schumann authored Jan 15, 2001
278
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
279 if (php_ini_opened_path) {
280 zval tmp;
281
c033288 Back-substitute for Z_* macro's. If it breaks some extension (the scr…
Jeroen van Wolffelaar authored Sep 25, 2001
282 Z_STRLEN(tmp) = strlen(php_ini_opened_path);
283 Z_STRVAL(tmp) = zend_strndup(php_ini_opened_path, Z_STRLEN(tmp));
284 Z_TYPE(tmp) = IS_STRING;
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
285 zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"), (void *) &tmp, sizeof(zval), NULL);
2ec4400 @zsuraski Get rid of a couple of bogus persist_alloc()'s, and some cleanup
zsuraski authored Aug 3, 2001
286 efree(php_ini_opened_path);
c033288 Back-substitute for Z_* macro's. If it breaks some extension (the scr…
Jeroen van Wolffelaar authored Sep 25, 2001
287 php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
288 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
289
290 return SUCCESS;
291 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
292 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
293
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
294 /* {{{ php_shutdown_config
295 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
296 int php_shutdown_config(void)
297 {
298 zend_hash_destroy(&configuration_hash);
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
299 if (php_ini_opened_path) {
2ec4400 @zsuraski Get rid of a couple of bogus persist_alloc()'s, and some cleanup
zsuraski authored Aug 3, 2001
300 free(php_ini_opened_path);
bd0ac7f @zsuraski Many patches. I hope I remember them all:
zsuraski authored Jan 2, 2001
301 }
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
302 return SUCCESS;
303 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
304 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
305
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
306 /* {{{ php_ini_delayed_modules_startup
307 */
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
308 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
309 {
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
310 zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb TSRMLS_CC);
311 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
312
313 zend_llist_destroy(&extension_lists.engine);
314 zend_llist_destroy(&extension_lists.functions);
315 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
316 /* }}} */
9db5589 @zsuraski Recode delayed loading in a much simpler way (switched back to php_in…
zsuraski authored Mar 17, 2001
317
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
318 /* {{{ cfg_get_entry
319 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
320 zval *cfg_get_entry(char *name, uint name_length)
321 {
322 zval *tmp;
323
324 if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) {
325 return tmp;
326 } else {
327 return NULL;
328 }
329 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
330 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
331
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
332 /* {{{ cfg_get_long
333 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
334 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
335 {
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
336 zval *tmp, var;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
337
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
338 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp)==FAILURE) {
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
339 *result=(long)NULL;
340 return FAILURE;
341 }
342 var = *tmp;
343 zval_copy_ctor(&var);
344 convert_to_long(&var);
c033288 Back-substitute for Z_* macro's. If it breaks some extension (the scr…
Jeroen van Wolffelaar authored Sep 25, 2001
345 *result = Z_LVAL(var);
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
346 return SUCCESS;
347 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
348 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
349
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
350 /* {{{ cfg_get_double
351 */
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
352 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
353 {
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
354 zval *tmp, var;
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
355
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
356 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp)==FAILURE) {
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
357 *result=(double)0;
358 return FAILURE;
359 }
360 var = *tmp;
361 zval_copy_ctor(&var);
362 convert_to_double(&var);
c033288 Back-substitute for Z_* macro's. If it breaks some extension (the scr…
Jeroen van Wolffelaar authored Sep 25, 2001
363 *result = Z_DVAL(var);
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
364 return SUCCESS;
365 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
366 /* }}} */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
367
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
368 /* {{{ cfg_get_string
369 */
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
370 PHPAPI int cfg_get_string(char *varname, char **result)
371 {
372 zval *tmp;
373
1159c84 @zsuraski - TSRMLS_FETCH work
zsuraski authored Aug 5, 2001
374 if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp)==FAILURE) {
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
375 *result=NULL;
376 return FAILURE;
377 }
c033288 Back-substitute for Z_* macro's. If it breaks some extension (the scr…
Jeroen van Wolffelaar authored Sep 25, 2001
378 *result = Z_STRVAL_P(tmp);
78194a4 @zsuraski - Complete the move to the new INI parser. (Side effect: at last, people
zsuraski authored Oct 30, 2000
379 return SUCCESS;
380 }
81e2cf0 @rlerdorf Fix folding and clean up some extensions
rlerdorf authored Jun 6, 2001
381 /* }}} */
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored Apr 22, 2001
382
383 /*
384 * Local variables:
385 * tab-width: 4
386 * c-basic-offset: 4
387 * indent-tabs-mode: t
388 * End:
78747bd - Don't wrap lines... this is annoying while coding.
Derick Rethans authored Sep 9, 2001
389 * vim600: sw=4 ts=4 fdm=marker
390 * vim<600: sw=4 ts=4
2cf1b8d * expanded the following constants and made them available in PHP:
Stig Bakken authored Apr 22, 2001
391 */
Something went wrong with that request. Please try again.