Commit 6cc7ae37 by Scott

Return null if not an array in qa_post_array

parent 0b7b22f1
......@@ -975,19 +975,21 @@
function qa_post_array($field)
/*
Return an array for incoming POST field, or null if it's not defined.
Return an array for incoming POST field, or null if it's not an array or not defined.
While we're at it, trim() surrounding white space for each value and convert them to Unix line endings.
*/
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (isset($_POST[$field])) {
$result = array();
foreach ($_POST[$field] as $key => $value)
$result[$key] = preg_replace('/\r\n?/', "\n", trim(qa_gpc_to_string($value)));
return $result;
if (!isset($_POST[$field]) || !is_array($_POST[$field])) {
return null;
}
return null;
$result = array();
foreach ($_POST[$field] as $key => $value)
$result[$key] = preg_replace('/\r\n?/', "\n", trim(qa_gpc_to_string($value)));
return $result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment