summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/init.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/inc/init.php b/inc/init.php
index 286850e94..416b117eb 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -260,11 +260,20 @@ function init_creationmodes(){
*/
function remove_magic_quotes(&$array) {
foreach (array_keys($array) as $key) {
- if (is_array($array[$key])) {
- remove_magic_quotes($array[$key]);
- }else {
- $array[$key] = stripslashes($array[$key]);
- }
+ // handle magic quotes in keynames (breaks order)
+ $sk = stripslashes($key);
+ if($sk != $key){
+ $array[$sk] = $array[$key];
+ unset($array[$key]);
+ $key = $sk;
+ }
+
+ // do recursion if needed
+ if (is_array($array[$key])) {
+ remove_magic_quotes($array[$key]);
+ }else {
+ $array[$key] = stripslashes($array[$key]);
+ }
}
}