com web/master: Reverting my last change. That was the wrong way to solve array input in $_POST with the filter. This wil l work correctly.:
manage/user-notes.php
| From: | Sherif Ramadan | Date: | Sat, 22 Dec 2012 04:38:32 +0000 |
| Subject: | com web/master: Reverting my last change. That was the wrong way to solve array input in $_POST with the filter. This wil l work correctly.: manage/user-notes.php |
||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15132@lists.php.net to get a copy of this message | ||
Commit: 810fea593b33c8e967925e1923d0df3201d3b7af
Author: Sherif Ramadan <googleguy@php.net> Fri, 21 Dec 2012 23:38:32 -0500
Parents: bcedf9ada03c244af031a64a5a18fabdb1ae107d
Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=810fea593b33c8e967925e1923d0df3201d3b7af
Log:
Reverting my last change. That was the wrong way to solve array input in $_POST with the filter.
This will work correctly.
Changed paths:
M manage/user-notes.php
Diff:
diff --git a/manage/user-notes.php b/manage/user-notes.php
index bb15deb..10be510 100644
--- a/manage/user-notes.php
+++ b/manage/user-notes.php
@@ -15,13 +15,10 @@ include '../include/note-reasons.inc';
- Please use hscr() as opposed to clean() and real_clean() as opposed to escape().
*/
foreach($_GET as $key => $val) $_GET[$key] = filter_input(INPUT_GET,$key,FILTER_UNSAFE_RAW);
-foreach($_POST as $key => $val) {
- if (!is_array($val)) {
- $_POST[$key] = filter_input(INPUT_POST,$key,FILTER_UNSAFE_RAW);
- } else {
- foreach ($val as $k=>$v) { $_POST[$key][$k] =
filter_input(INPUT_POST,$val[$k],FILTER_UNSAFE_RAW); }
- }
-}
+$args = array();
+foreach($_POST as $key => $val) $args[$key] = array('filter' => FILTER_UNSAFE_RAW,
'flags' => is_array($val) ? FILTER_REQUIRE_ARRAY : FILTER_REQUIRE_SCALAR);
+$_POST = filter_input_array(INPUT_POST, $args);
+unset($args);
foreach($_COOKIE as $key => $val) $_COOKIE[$key] =
filter_input(INPUT_COOKIE,$key,FILTER_UNSAFE_RAW);
foreach($_POST as $key => $val) $_REQUEST[$key] =
filter_input(INPUT_POST,$key,FILTER_UNSAFE_RAW);
foreach($_GET as $key => $val) $_REQUEST[$key] = filter_input(INPUT_GET,$key,FILTER_UNSAFE_RAW);