summaryrefslogtreecommitdiff
path: root/main/php_variables.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-07-29 15:43:37 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-07-29 15:43:37 +0000
commit22db4041320761e5ae76e3581797d7e0db009285 (patch)
tree84e0fead7901c7da0b4d42c0d8b6985a0ad69a68 /main/php_variables.c
parentf66d5f0cc5209c1166ec4f1e64fa44998f76aa14 (diff)
downloadphp-git-22db4041320761e5ae76e3581797d7e0db009285.tar.gz
Fixed bug #33904 (input array keys being escaped when magic quotes is off).
Diffstat (limited to 'main/php_variables.c')
-rw-r--r--main/php_variables.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/main/php_variables.c b/main/php_variables.c
index 79caaec646..31f80674e1 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -183,7 +183,13 @@ plain_var:
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);
+ char *escaped_index;
+
+ if (PG(magic_quotes_gpc)) {
+ escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
+ } else {
+ escaped_index = index;
+ }
/*
* 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
@@ -196,7 +202,9 @@ plain_var:
break;
}
zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- efree(escaped_index);
+ if (PG(magic_quotes_gpc)) {
+ efree(escaped_index);
+ }
}
break;
}