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

fix(api): Resource::list return empty list if the regex is not valid #8437

Merged
merged 19 commits into from
Mar 25, 2020
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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 @@ -255,6 +255,14 @@ private function createQueryOnKeyValue(string $key, $valueOrArray): string
|| $searchOperator === RequestParameters::OPERATOR_NOT_LIKE
|| $searchOperator === RequestParameters::OPERATOR_REGEXP
) {
// We check the regex
if ($searchOperator === RequestParameters::OPERATOR_REGEXP) {
try {
preg_match($mixedValue, '');
vhr marked this conversation as resolved.
Show resolved Hide resolved
} catch (\Throwable $ex) {
throw new RequestParametersTranslatorException('Bad regex format \'' . $mixedValue . '\'', 0, $ex);
callapa marked this conversation as resolved.
Show resolved Hide resolved
}
}
$type = \PDO::PARAM_STR;
$bindKey = ':value_' . (count($this->searchValues) + 1);
$this->searchValues[$bindKey] = [$type => $mixedValue];
Expand Down