Clean up POST keys containing square brackets, allows for regex ranges in routes (fixes #776)

This commit is contained in:
Djamil Legato
2016-09-15 12:57:28 -07:00
parent 0512a7f4f6
commit aba43374de
5 changed files with 39 additions and 16 deletions

View File

@@ -2490,6 +2490,8 @@ class AdminController
unset($post['_json']);
}
$post = $this->cleanDataKeys($post);
return $post;
}
@@ -2701,4 +2703,21 @@ class AdminController
return $files;
}
protected function cleanDataKeys($source = []){
$out = [];
if (is_array($source)) {
foreach($source as $key => $value){
$key = str_replace('%5B', '[', str_replace('%5D', ']', $key));
if (is_array($value)) {
$out[$key] = $this->cleanDataKeys($value);
} else{
$out[$key] = $value;
}
}
}
return $out;
}
}