mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
MFB: fix php_value application order for Apache
This commit is contained in:
parent
f95b96e55a
commit
f778e6c4f9
@ -738,11 +738,11 @@ static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_per_di
|
||||
return 1; /* does not exist in dest, copy from source */
|
||||
}
|
||||
|
||||
if (new_per_dir_entry->type==PHP_INI_SYSTEM
|
||||
&& orig_per_dir_entry->type!=PHP_INI_SYSTEM) {
|
||||
return 1;
|
||||
} else {
|
||||
if (orig_per_dir_entry->type==PHP_INI_SYSTEM
|
||||
&& new_per_dir_entry->type!=PHP_INI_SYSTEM) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -779,9 +779,9 @@ static void *php_merge_dir(pool *p, void *basev, void *addv)
|
||||
|
||||
/* need a copy of addv to merge */
|
||||
new = php_create_dir(p, "php_merge_dir");
|
||||
zend_hash_copy(new, (HashTable *) addv, (copy_ctor_func_t) copy_per_dir_entry, NULL, sizeof(php_per_dir_entry));
|
||||
zend_hash_copy(new, (HashTable *) basev, (copy_ctor_func_t) copy_per_dir_entry, NULL, sizeof(php_per_dir_entry));
|
||||
|
||||
zend_hash_merge_ex(new, (HashTable *) basev, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
|
||||
zend_hash_merge_ex(new, (HashTable *) addv, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
|
||||
return new;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -117,6 +117,23 @@ static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const ch
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_dir_entry *new_per_dir_entry, zend_hash_key *hash_key, void *pData)
|
||||
{
|
||||
php_dir_entry *orig_per_dir_entry;
|
||||
|
||||
if (zend_hash_find(target_ht, hash_key->arKey.s, hash_key->nKeyLength, (void **) &orig_per_dir_entry)==FAILURE) {
|
||||
return 1; /* does not exist in dest, copy from source */
|
||||
}
|
||||
|
||||
if (new_per_dir_entry->status >= orig_per_dir_entry->status) {
|
||||
/* use new entry */
|
||||
phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", hash_key->arKey.s, new_per_dir_entry->status, orig_per_dir_entry->status));
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
|
||||
{
|
||||
@ -128,9 +145,12 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
|
||||
ulong num_index;
|
||||
|
||||
n = create_php_config(p, "merge_php_config");
|
||||
zend_hash_copy(&n->config, &e->config, NULL, NULL, sizeof(php_dir_entry));
|
||||
|
||||
/* copy old config */
|
||||
zend_hash_copy(&n->config, &d->config, NULL, NULL, sizeof(php_dir_entry));
|
||||
/* 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, sizeof(php_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
|
||||
#if STAS_0
|
||||
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;
|
||||
@ -143,7 +163,7 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
|
||||
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));
|
||||
}
|
||||
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user