diff options
author | Michael Wallner <mike@php.net> | 2006-06-09 15:13:12 +0000 |
---|---|---|
committer | Michael Wallner <mike@php.net> | 2006-06-09 15:13:12 +0000 |
commit | d6b04eb53ea927ce55b795f6a1447e077a153584 (patch) | |
tree | 833e1f53d108dfc43834fb5b7678199461838864 /sapi | |
parent | 654b601543730ad6c4b10860bfd0eb2aeeef1b9c (diff) | |
download | php-git-d6b04eb53ea927ce55b795f6a1447e077a153584.tar.gz |
- fix bug #37720 (merge_php_config scrambles values)
Diffstat (limited to 'sapi')
-rw-r--r-- | sapi/apache2handler/apache_config.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index 49173b86ff..62806412d9 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -118,27 +118,31 @@ static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const ch void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf) { - php_conf_rec *d = base_conf, *e = new_conf; + php_conf_rec *d = base_conf, *e = new_conf, *n = NULL; php_dir_entry *pe; php_dir_entry *data; zstr str; uint str_len; ulong num_index; - phpapdebug((stderr, "Merge dir (%p) (%p)\n", base_conf, new_conf)); + n = create_php_config(p, "merge_php_config"); + zend_hash_copy(&n->config, &e->config, NULL, NULL, sizeof(php_dir_entry)); + + phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)\n", base_conf, new_conf, n)); for (zend_hash_internal_pointer_reset(&d->config); zend_hash_get_current_key_ex(&d->config, &str, &str_len, &num_index, 0, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(&d->config)) { pe = NULL; zend_hash_get_current_data(&d->config, (void **) &data); - if (zend_hash_find(&e->config, str.s, str_len, (void **) &pe) == SUCCESS) { + if (zend_hash_find(&n->config, str.s, str_len, (void **) &pe) == SUCCESS) { if (pe->status >= data->status) continue; } - zend_hash_update(&e->config, str.s, str_len, data, sizeof(*data), NULL); - phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1)); + zend_hash_update(&n->config, str.s, str_len, data, sizeof(*data), NULL); + phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str.s, data->status, pe?pe->status:-1)); } - return new_conf; + + return n; } char *get_php_config(void *conf, char *name, size_t name_len) |