MDL-61028 core_search: Fix SELECT bug affecting Oracle
authorsam marshall <s.marshall@open.ac.uk>
Tue, 24 Apr 2018 11:08:35 +0000 (12:08 +0100)
committerDavid Monllao <davidm@moodle.com>
Tue, 24 Apr 2018 13:48:40 +0000 (15:48 +0200)
lib/classes/user.php

index ce986c9..89ba7b5 100644 (file)
@@ -261,7 +261,7 @@ class core_user {
         if (!in_array('deleted', $extra)) {
             $extrafieldlist[] = 'deleted';
         }
-        $extrafields = \user_picture::fields('u',
+        $selectfields = \user_picture::fields('u',
                 array_merge(get_all_user_name_fields(), $extrafieldlist));
 
         $index = 1;
@@ -327,7 +327,7 @@ class core_user {
         $readcount = $max + 2;
         for ($i = 0; $i < $querylimit; $i++) {
             $rawresult = $DB->get_records_sql("
-                    SELECT users.*, $extrafields
+                    SELECT $selectfields
                       FROM ($userquery) users
                       JOIN {user} u ON u.id = users.id
                      WHERE $where