Fix undefined filter check in db_object_t trait logic
Ensure the filter is set before validating its value against allowed options. This prevents potential undefined index errors when filters are not provided.
This commit is contained in:
@@ -408,7 +408,8 @@ trait db_object_t
|
||||
foreach ( $fieldsAndValues as $field => $value ) {
|
||||
// If the value is an array, check if the user tries to search for a different value than the ones provided
|
||||
if (is_array($value)) {
|
||||
if (!in_array($filters[$field], $value)) {
|
||||
// Check if the filter is even set
|
||||
if (isset($filters[$field]) && !in_array($filters[$field], $value)) {
|
||||
throw new Exception('Invalid filter: ' . $field . ' - ' . $filters[$field] . '. Permitted values: ' . implode(', ', $value));
|
||||
}
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user