Skip to content

Commit c4d79d7

Browse files
Merged Pull Request '#5 feature/post-query->main : 'Used both GET and POST parameters when adding evidence from HTTP requests.''
Used both GET and POST parameters when adding evidence from HTTP requests.
2 parents d113c3c + 4a75041 commit c4d79d7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Evidence.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ public function setArray($array)
7979

8080
/**
8181
* Extract evidence from a web request
82-
* No argument version automatically reads from current request
83-
* @param $_SERVER
84-
* @param $_COOKIE
82+
* No argument version automatically reads from current request using the
83+
* $_SERVER, $_COOKIE, $_GET and $_POST globals
84+
* @param $server key value pairs for the HTTP headers
85+
* @param $cookies key value pairs for the cookies
86+
* @param $query key value pairs for the form parameters
8587
*/
8688
public function setFromWebRequest($server = null, $cookies = null, $query = null)
8789
{
@@ -94,7 +96,9 @@ public function setFromWebRequest($server = null, $cookies = null, $query = null
9496
}
9597

9698
if (!$query) {
97-
$query = $_GET;
99+
// Merge the GET and POST parameters favoring the GET keys if there
100+
// are keys that conflict.
101+
$query = array_merge($_POST, $_GET);
98102
}
99103

100104
$evidence = array();
@@ -105,15 +109,18 @@ public function setFromWebRequest($server = null, $cookies = null, $query = null
105109

106110
$key = strtolower($key);
107111

112+
error_log("header." . $key . ": " . $value, 0);
108113
$evidence["header." . $key] = $value;
109114
}
110115
}
111116

112117
foreach ($cookies as $key => $value) {
118+
error_log("cookie." . $key . ": " . $value, 0);
113119
$evidence["cookie." . $key] = $value;
114120
}
115121

116122
foreach ($query as $key => $value) {
123+
error_log("query." . $key . ": " . $value, 0);
117124
$evidence["query." . $key] = $value;
118125
}
119126

0 commit comments

Comments
 (0)