diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2005-04-24 17:52:58 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2005-04-24 17:52:58 +0000 |
commit | 5135548c9d9358c08636451be9ec3b3764cbae8c (patch) | |
tree | e8691d6e2f1411254b963d4db28a5ad4644ab8b8 /main/php_variables.c | |
parent | eb393b600cf645d639d9ca5fc9aaa4bdcefd9e65 (diff) | |
download | php-git-5135548c9d9358c08636451be9ec3b3764cbae8c.tar.gz |
MFH: Fixed bug #32802 (General cookie overrides more specific cookie).
Diffstat (limited to 'main/php_variables.c')
-rw-r--r-- | main/php_variables.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/main/php_variables.c b/main/php_variables.c index b3307a51d7..0eed752b37 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -186,7 +186,19 @@ plain_var: if (!index) { zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } else { + zval *tmp; char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); + /* + * According to rfc2965, more specific paths are listed above the less specific ones. + * If we encounter a duplicate cookie name, we should skip it, since it is not possible + * to have the same (plain text) cookie name for the same path and we should not overwrite + * more specific cookies with the less specific ones. + */ + if (PG(http_globals)[TRACK_VARS_COOKIE] && symtable1 == Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) && + zend_symtable_find(symtable1, escaped_index, index_len+1, (void **) &tmp) != FAILURE) { + efree(escaped_index); + break; + } zend_symtable_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); efree(escaped_index); } |