fix error collation events pandora_enterprise#9290

This commit is contained in:
Daniel Barbero Martin 2022-07-26 07:57:04 +02:00
parent e30eff5e6e
commit 9d33fa08fe
1 changed files with 29 additions and 11 deletions

View File

@ -1091,6 +1091,9 @@ function events_get_all(
// Custom data.
if (empty($filter['custom_data']) === false) {
if (isset($config['dbconnection']->server_version) === true
&& $config['dbconnection']->server_version > 50600
) {
if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
@ -1104,6 +1107,21 @@ function events_get_all(
io_safe_output($filter['custom_data'])
);
}
} else {
if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ',
$filter['custom_data'],
$filter['custom_data']
);
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ',
$filter['custom_data'],
$filter['custom_data']
);
}
}
}
// Validated or in process by.