Skip to content

Commit

Permalink
fix issue when query filter has empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
Mh-Asmi committed Oct 8, 2024
1 parent eea8a8e commit 54d057f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Ushahidi/Modules/V5/DTO/PostSearchFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ private function getParameterAsArray($parameter_value)
if ($parameter_value) {
if (is_array($parameter_value)) {
$filter_values = $parameter_value;
foreach ($filter_values as $key => $value) { // to handle case of passing empty value as array
if (trim($value) === "") {
unset($filter_values[$key]);
}
}
} else {
$filter_values = explode(',', $parameter_value);
}
Expand Down

0 comments on commit 54d057f

Please sign in to comment.