diff options
Diffstat (limited to 'sapi/apache2handler/apache_config.c')
-rw-r--r-- | sapi/apache2handler/apache_config.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index 636eee2d4b..38ff99aa7b 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -135,6 +135,14 @@ static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, zval *zv, } } +void config_entry_ctor(zval *zv) +{ + php_dir_entry *pe = (php_dir_entry*)Z_PTR_P(zv); + php_dir_entry *npe = malloc(sizeof(php_dir_entry)); + + memcpy(npe, pe, sizeof(php_dir_entry)); + ZVAL_PTR(zv, npe); +} void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf) { @@ -142,12 +150,10 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf) n = create_php_config(p, "merge_php_config"); /* copy old config */ - zend_hash_copy(&n->config, &d->config, NULL); -//??? zend_hash_copy(&n->config, &d->config, NULL, NULL, sizeof(php_dir_entry)); + zend_hash_copy(&n->config, &d->config, config_entry_ctor); /* merge new config */ phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)\n", base_conf, new_conf, n)); - zend_hash_merge_ex(&n->config, &e->config, NULL, should_overwrite_per_dir_entry, NULL); -//??? zend_hash_merge_ex(&n->config, &e->config, NULL, sizeof(php_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL); + zend_hash_merge_ex(&n->config, &e->config, config_entry_ctor, should_overwrite_per_dir_entry, NULL); return n; } @@ -197,12 +203,17 @@ static apr_status_t destroy_php_config(void *data) return APR_SUCCESS; } +static void config_entry_dtor(zval *zv) +{ + free((php_dir_entry*)Z_PTR_P(zv)); +} + void *create_php_config(apr_pool_t *p, char *dummy) { php_conf_rec *newx = (php_conf_rec *) apr_pcalloc(p, sizeof(*newx)); phpapdebug((stderr, "Creating new config (%p) for %s\n", newx, dummy)); - zend_hash_init(&newx->config, 0, NULL, NULL, 1); + zend_hash_init(&newx->config, 0, NULL, config_entry_dtor, 1); apr_pool_cleanup_register(p, newx, destroy_php_config, apr_pool_cleanup_null); return (void *) newx; } |