Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(api): Removing host type AND having the cursor in the search bar sends an error 500 #8432

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ private function createQueryOnKeyValue(string $key, $valueOrArray): string
if (is_array($valueOrArray)) {
$searchOperator = (string) key($valueOrArray);
$mixedValue = $valueOrArray[$searchOperator];

// replace REGEXP operator with LIKE if it's not valid
if (
$mixedValue
&& $searchOperator === RequestParameters::OPERATOR_REGEXP
&& @preg_match("/{$mixedValue}/", '') === false
) {
$searchOperator = RequestParameters::OPERATOR_LIKE;
}
} else {
$searchOperator = RequestParameters::DEFAULT_SEARCH_OPERATOR;
$mixedValue = $valueOrArray;
Expand Down