diff options
Diffstat (limited to 'main')
| -rw-r--r-- | main/main.c | 82 | ||||
| -rw-r--r-- | main/php_ini.c | 16 | ||||
| -rw-r--r-- | main/php_ini.h | 19 |
3 files changed, 64 insertions, 53 deletions
diff --git a/main/main.c b/main/main.c index 3cd96ae760..7ff0782755 100644 --- a/main/main.c +++ b/main/main.c @@ -187,60 +187,60 @@ static PHP_INI_MH(OnUpdateErrorReporting) #endif PHP_INI_BEGIN() - PHP_INI_ENTRY("short_open_tag", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, short_tags)) - PHP_INI_ENTRY("asp_tags", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, asp_tags)) - PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision, NULL) + PHP_INI_ENTRY1("short_open_tag", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, short_tags)) + PHP_INI_ENTRY1("asp_tags", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, asp_tags)) + PHP_INI_ENTRY1("precision", "14", PHP_INI_ALL, OnSetPrecision, NULL) - PHP_INI_ENTRY("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_gpc)) - PHP_INI_ENTRY("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_runtime)) - PHP_INI_ENTRY("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_sybase)) + PHP_INI_ENTRY1("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_gpc)) + PHP_INI_ENTRY1("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_runtime)) + PHP_INI_ENTRY1("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_sybase)) - PHP_INI_ENTRY("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, safe_mode)) - PHP_INI_ENTRY("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, sql_safe_mode)) - PHP_INI_ENTRY("safe_mode_exec_dir", SAFE_MODE_EXEC_DIR, PHP_INI_SYSTEM, OnUpdateString, (void *) XtOffsetOf(php_core_globals, safe_mode_exec_dir)) - PHP_INI_ENTRY("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, enable_dl)) + PHP_INI_ENTRY1("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, safe_mode)) + PHP_INI_ENTRY1("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, sql_safe_mode)) + PHP_INI_ENTRY1("safe_mode_exec_dir", SAFE_MODE_EXEC_DIR, PHP_INI_SYSTEM, OnUpdateString, (void *) XtOffsetOf(php_core_globals, safe_mode_exec_dir)) + PHP_INI_ENTRY1("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, enable_dl)) - PHP_INI_ENTRY("SMTP", "localhost", PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL, NULL) - PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("SMTP", "localhost", PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL, NULL) + PHP_INI_ENTRY1("sendmail_from", NULL, PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting, NULL) - PHP_INI_ENTRY("display_errors", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, display_errors)) - PHP_INI_ENTRY("track_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_errors)) - PHP_INI_ENTRY("log_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, log_errors)) - PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, error_log)) + PHP_INI_ENTRY1("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting, NULL) + PHP_INI_ENTRY1("display_errors", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, display_errors)) + PHP_INI_ENTRY1("track_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_errors)) + PHP_INI_ENTRY1("log_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, log_errors)) + PHP_INI_ENTRY1("error_log", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, error_log)) - PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_prepend_file)) - PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_append_file)) + PHP_INI_ENTRY1("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_prepend_file)) + PHP_INI_ENTRY1("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_append_file)) - PHP_INI_ENTRY("y2k_compliance", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, y2k_compliance)) + PHP_INI_ENTRY1("y2k_compliance", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, y2k_compliance)) - PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, doc_root)) - PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, user_dir)) - PHP_INI_ENTRY("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, include_path)) - PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, open_basedir)) - PHP_INI_ENTRY("extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, extension_dir)) + PHP_INI_ENTRY1("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, doc_root)) + PHP_INI_ENTRY1("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, user_dir)) + PHP_INI_ENTRY1("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, include_path)) + PHP_INI_ENTRY1("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, open_basedir)) + PHP_INI_ENTRY1("extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, extension_dir)) - PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, upload_tmp_dir)) - PHP_INI_ENTRY("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, upload_max_filesize)) + PHP_INI_ENTRY1("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, upload_tmp_dir)) + PHP_INI_ENTRY1("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, upload_max_filesize)) - PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL, NULL) + PHP_INI_ENTRY1("browscap", NULL, PHP_INI_SYSTEM, NULL, NULL) - PHP_INI_ENTRY("define_syslog_variables", "0", PHP_INI_ALL, NULL, NULL) + PHP_INI_ENTRY1("define_syslog_variables", "0", PHP_INI_ALL, NULL, NULL) - PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnChangeMaxExecutionTime, NULL) - PHP_INI_ENTRY("memory_limit", "8388608", PHP_INI_ALL, OnChangeMemoryLimit, NULL) + PHP_INI_ENTRY1("max_execution_time", "30", PHP_INI_ALL, OnChangeMaxExecutionTime, NULL) + PHP_INI_ENTRY1("memory_limit", "8388608", PHP_INI_ALL, OnChangeMemoryLimit, NULL) - PHP_INI_ENTRY("track_vars", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_vars)) - PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, gpc_order)) - PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, arg_separator)) + PHP_INI_ENTRY1("track_vars", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_vars)) + PHP_INI_ENTRY1("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, gpc_order)) + PHP_INI_ENTRY1("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, arg_separator)) PHP_INI_END() diff --git a/main/php_ini.c b/main/php_ini.c index a58c0ba9d9..a4725c05e1 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -106,17 +106,17 @@ int php_register_ini_entries(php_ini_entry *ini_entry, int module_number) return FAILURE; } if (hashed_ini_entry->on_modify) { - hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg); + hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3); } if ((default_value=cfg_get_entry(p->name, p->name_length))) { if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg)==SUCCESS) { + || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3)==SUCCESS) { hashed_ini_entry->value = default_value->value.str.val; hashed_ini_entry->value_length = default_value->value.str.len; } } else { if (hashed_ini_entry->on_modify) { - hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg); + hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3); } } hashed_ini_entry->modified = 0; @@ -148,7 +148,7 @@ int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_ duplicate = estrndup(new_value, new_value_length); if (!ini_entry->on_modify - || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg)==SUCCESS) { + || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3)==SUCCESS) { if (!ini_entry->orig_value) { ini_entry->orig_value = ini_entry->value; ini_entry->orig_value_length = ini_entry->value_length; @@ -249,7 +249,7 @@ PHP_INI_MH(OnUpdateInt) base = (char *) core_globals; #endif - p = (long *) (base+(size_t) mh_arg); + p = (long *) (base+(size_t) mh_arg1); *p = atoi(new_value); return SUCCESS; @@ -268,7 +268,7 @@ PHP_INI_MH(OnUpdateReal) base = (char *) core_globals; #endif - p = (double *) (base+(size_t) mh_arg); + p = (double *) (base+(size_t) mh_arg1); *p = strtod(new_value, NULL); return SUCCESS; @@ -287,7 +287,7 @@ PHP_INI_MH(OnUpdateString) base = (char *) core_globals; #endif - p = (char **) (base+(size_t) mh_arg); + p = (char **) (base+(size_t) mh_arg1); *p = new_value; return SUCCESS; @@ -310,7 +310,7 @@ PHP_INI_MH(OnUpdateStringUnempty) return FAILURE; } - p = (char **) (base+(size_t) mh_arg); + p = (char **) (base+(size_t) mh_arg1); *p = new_value; return SUCCESS; diff --git a/main/php_ini.h b/main/php_ini.h index eaedca5aaa..12e7b5da7b 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -10,7 +10,7 @@ typedef struct _php_ini_entry php_ini_entry; -#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg) +#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3) struct _php_ini_entry { int module_number; @@ -18,7 +18,9 @@ struct _php_ini_entry { char *name; uint name_length; PHP_INI_MH((*on_modify)); - void *mh_arg; + void *mh_arg1; + void *mh_arg2; + void *mh_arg3; char *value; uint value_length; @@ -44,8 +46,17 @@ char *php_ini_string(char *name, uint name_length, int orig); #define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = { -#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify, ptr) \ - { 0, modifyable, name, sizeof(name), on_modify, ptr, default_value, sizeof(default_value)-1, NULL, 0, 0 }, +#define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \ + { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0 }, + +#define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \ + PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, NULL) + +#define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \ + PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, NULL, NULL) + +#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \ + PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, NULL, NULL, NULL) #define PHP_INI_END() \ { 0, 0, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, 0 } }; |
