]> granicus.if.org Git - php/commitdiff
Fixed bug #33904 (input array keys being escaped when magic quotes is off).
authorIlia Alshanetsky <iliaa@php.net>
Fri, 29 Jul 2005 15:43:37 +0000 (15:43 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 29 Jul 2005 15:43:37 +0000 (15:43 +0000)
NEWS
main/php_variables.c

diff --git a/NEWS b/NEWS
index 8d10f9218e37409d642dee63b1ecbae1485a76df..623faa96e5610826cd1ecfbeccd8e5952e02279c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2005, PHP 5.1
 - Fixed bug #33917 (number_format() output with > 1 char separators). (Jani)
+- Fixed bug #33904 (input array keys being escaped when magic quotes is off). 
+  (Ilia)
 - Fixed bug #33899 (CLI: setting extension_dir=some/path extension=foobar.so
   does not work). (Jani)
 - Fixed bug #33882 (CLI was looking for php.ini in wrong path). (Hartmut)
index 79caaec646a638d9bbe56f6345d82d0426c1117e..31f80674e1ef91cd07fd8249546e1bd918fa31b0 100644 (file)
@@ -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;
                }