From: Stanislav Malyshev Date: Fri, 3 Aug 2007 01:14:44 +0000 (+0000) Subject: implement separate .htaccess stage X-Git-Tag: php-5.2.4RC2~109 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c94dee86969d1dd58386f9b8c780a38e2b4532eb;p=php implement separate .htaccess stage --- diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c index 439ef168e7..d41d9dfcd6 100644 --- a/sapi/apache/mod_php5.c +++ b/sapi/apache/mod_php5.c @@ -80,6 +80,7 @@ typedef struct _php_per_dir_entry { uint key_length; uint value_length; int type; + char htaccess; } php_per_dir_entry; /* some systems are missing these from their header files */ @@ -547,7 +548,7 @@ static void init_request_info(TSRMLS_D) */ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC) { - zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE); return 0; } /* }}} */ @@ -791,6 +792,7 @@ static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable php_apache_startup(&apache_sapi_module); } per_dir_entry.type = mode; + per_dir_entry.htaccess = ((cmd->override & (RSRC_CONF|ACCESS_CONF)) == 0); if (strcasecmp(arg2, "none") == 0) { arg2 = ""; diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index 1c6b9ab0f6..14d00a322b 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -51,6 +51,7 @@ typedef struct { char *value; size_t value_len; char status; + char htaccess; } php_dir_entry; static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name, const char *value, int status) @@ -67,7 +68,8 @@ static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name, e.value = apr_pstrdup(cmd->pool, value); e.value_len = strlen(value); e.status = status; - + e.htaccess = ((cmd->override & (RSRC_CONF|ACCESS_CONF)) == 0); + zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e, sizeof(e), NULL); return NULL; } @@ -170,7 +172,7 @@ void apply_config(void *dummy) zend_hash_move_forward(&d->config)) { zend_hash_get_current_data(&d->config, (void **) &data); phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value)); - if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, PHP_INI_STAGE_ACTIVATE) == FAILURE) { + if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) { phpapdebug((stderr, "..FAILED\n")); } }