MDL-82170 user: replace increment operator on string type variable.

This commit is contained in:
Paul Holden
2025-02-05 20:08:34 +00:00
parent 07881a5772
commit db01833822
2 changed files with 21 additions and 25 deletions
+4 -7
View File
@@ -382,12 +382,10 @@ function users_order_by_sql(string $usertablealias = '', ?string $search = null,
}
$exactconditions = array();
$paramkey = 'usersortexact1';
$exactconditions[] = $DB->sql_fullname($tableprefix . 'firstname', $tableprefix . 'lastname') .
' = :' . $paramkey;
$params[$paramkey] = $search;
$paramkey++;
' = :usersortexact';
$params['usersortexact'] = $search;
if ($customfieldmappings) {
$fieldstocheck = array_merge([$tableprefix . 'firstname', $tableprefix . 'lastname'], array_values($customfieldmappings));
@@ -399,9 +397,8 @@ function users_order_by_sql(string $usertablealias = '', ?string $search = null,
}
foreach ($fieldstocheck as $key => $field) {
$exactconditions[] = 'LOWER(' . $field . ') = LOWER(:' . $paramkey . ')';
$params[$paramkey] = $search;
$paramkey++;
$exactconditions[] = 'LOWER(' . $field . ') = LOWER(:usersortfield' . $key . ')';
$params['usersortfield' . $key] = $search;
}
$sort = 'CASE WHEN ' . implode(' OR ', $exactconditions) .