diff options
-rw-r--r-- | main/php_ini.c | 6 | ||||
-rw-r--r-- | mod_php3.c | 40 |
2 files changed, 46 insertions, 0 deletions
diff --git a/main/php_ini.c b/main/php_ini.c index 4a329a9717..e57db71a69 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -58,6 +58,8 @@ static int php_restore_ini_entry_cb(php_ini_entry *ini_entry) ini_entry->value = ini_entry->orig_value; ini_entry->value_length = ini_entry->orig_value_length; ini_entry->modified = 0; + ini_entry->orig_value = NULL; + ini_entry->orig_value_length = 0; } return 0; } @@ -109,6 +111,10 @@ int php_register_ini_entries(php_ini_entry *ini_entry, int module_number) 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->modified = 0; p++; diff --git a/mod_php3.c b/mod_php3.c index 802b967f4d..c14c2d4ba1 100644 --- a/mod_php3.c +++ b/mod_php3.c @@ -49,6 +49,14 @@ #include "http_log.h" #endif + +/* These are taken out of php_ini.h + * they must be updated if php_ini.h changes! + */ +#define PHP_INI_USER (1<<0) +#define PHP_INI_PERDIR (1<<1) +#define PHP_INI_SYSTEM (1<<2) + #include "util_script.h" #include "php_version.h" @@ -384,6 +392,36 @@ char *php3flaghandler(cmd_parms * cmd, php3_ini_structure * conf, int val) return NULL; } + +#if MODULE_MAGIC_NUMBER > 19961007 +#define CONST_PREFIX const +#else +#define CONST_PREFIX +#endif + +CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php3_ini_structure *conf, char *arg1, char *arg2) +{ + php_alter_ini_entry(arg1, strlen(arg1)+1, arg2, strlen(arg2)+1, PHP_INI_PERDIR); + return NULL; +} + + +CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php3_ini_structure *conf, char *arg1, char *arg2) +{ + char bool_val[2]; + + if (!strcmp(arg2, "On")) { + bool_val[0] = '1'; + } else { + bool_val[0] = '0'; + } + bool_val[1] = 0; + + php_alter_ini_entry(arg1, strlen(arg1)+1, bool_val, 2, PHP_INI_PERDIR); + return NULL; +} + + #if MODULE_MAGIC_NUMBER > 19961007 const char *php3take1handler(cmd_parms * cmd, php3_ini_structure * conf, char *arg) { @@ -546,6 +584,8 @@ handler_rec php3_handlers[] = command_rec php3_commands[] = { + {"php4_directive", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"}, + {"php4_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"}, {"php3_error_reporting", php3take1handler, (void *)0, OR_OPTIONS, TAKE1, "error reporting level"}, {"php3_doc_root", php3take1handler, (void *)1, ACCESS_CONF|RSRC_CONF, TAKE1, "directory"}, /* not used yet */ {"php3_user_dir", php3take1handler, (void *)2, ACCESS_CONF|RSRC_CONF, TAKE1, "user directory"}, /* not used yet */ |