Skip to content

Commit

Permalink
fixed json decoding error when processing http rest api request data
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGalicia authored Dec 18, 2024
1 parent c0f581f commit 268e228
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions public/legacy/include/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -2654,15 +2654,21 @@ function clean_incoming_data()
$post = array_map('securexss', $_POST);
$get = array_map('securexss', $_GET);

$excluded_fields = ['rest_data'];

// PHP cannot stomp out superglobals reliably
foreach ($post as $k => $v) {
$_POST[$k] = $v;
if (!in_array($k, $excluded_fields)) {
$_POST[$k] = $v;
}
}
foreach ($get as $k => $v) {
$_GET[$k] = $v;
}
foreach ($req as $k => $v) {
$_REQUEST[$k] = $v;
if (!in_array($k, $excluded_fields)) {
$_REQUEST[$k] = $v;
}

//ensure the keys are safe as well. If mbstring encoding translation is on, the post keys don't
//get translated, so scrub the data but don't die
Expand Down

0 comments on commit 268e228

Please sign in to comment.