Fix JSON payload parsing in payment server
This commit is contained in:
@@ -184,6 +184,17 @@ function authenticateJWT(bool $isReg = false): object
|
||||
|
||||
|
||||
function filterRequest($requestname, $type = 'string') {
|
||||
// If $_POST is empty, try parsing JSON from php://input
|
||||
if (empty($_POST)) {
|
||||
$json = file_get_contents('php://input');
|
||||
if (!empty($json)) {
|
||||
$data = json_decode($json, true);
|
||||
if (is_array($data)) {
|
||||
$_POST = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST[$requestname]) && !empty($_POST[$requestname])) {
|
||||
$value = trim($_POST[$requestname]);
|
||||
// Remove any control characters
|
||||
|
||||
Reference in New Issue
Block a user