Moodle
  1. Moodle
  2. MDL-26607

Error reading from database when attempting a messages advanced search for a person in my courses

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Messages
    • Labels:
    • Rank:
      16400

      Description

      Attempting a messages advanced search for a person with 'Only in my courses' ticked.

      Error reading from database

      Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM mdl_user u, mc.id as contactlistid, mc.blocked
      ' at line 2
      SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email,
      FROM mdl_user u, mc.id as contactlistid, mc.blocked
      JOIN mdl_role_assignments ra ON ra.userid = u.id
      LEFT JOIN mdl_message_contacts mc
      ON mc.contactid = u.id AND mc.userid = ?
      WHERE u.deleted = '0' AND u.confirmed = '1'
      AND ra.contextid IN (10,3,1)
      AND (LOWER(CONCAT(firstname, ' ', lastname)) LIKE LOWER COLLATE utf8_bin ESCAPE '
      ')

      [array (
      0 => '4',
      1 => '%sally%',
      )]
      Stack trace:

      • line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      • line 790 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 1454 of /message/lib.php: call to mysqli_native_moodle_database->get_records_sql()
      • line 979 of /message/lib.php: call to message_search_users()
      • line 615 of /message/lib.php: call to message_print_search_results()
      • line 302 of /message/index.php: call to message_print_search()

        Issue Links

          Activity

          Hide
          Helen Foster added a comment -

          This problem is also affecting moodle.org, as reported by Vadim Dvorovenko in MDLSITE-1232.

          Show
          Helen Foster added a comment - This problem is also affecting moodle.org, as reported by Vadim Dvorovenko in MDLSITE-1232 .
          Hide
          Vadim Dvorovenko added a comment -

          it does not refer to main problem, but i think that <CONCAT(firstname, ' ', lastname)> should be replaced to something, that takes into account "fullnamedisplay" (Full Name Format) config setting. Accrording to this setting, in some sites firstname and lastname can have different order, in some sites fullname can refer only to firstname.

          Show
          Vadim Dvorovenko added a comment - it does not refer to main problem, but i think that <CONCAT(firstname, ' ', lastname)> should be replaced to something, that takes into account "fullnamedisplay" (Full Name Format) config setting. Accrording to this setting, in some sites firstname and lastname can have different order, in some sites fullname can refer only to firstname.
          Hide
          Andrew Davis added a comment -

          repo: git://github.com/andyjdavis/moodle.git
          branch: MDL-26607_search_error
          diff: https://github.com/andyjdavis/moodle/compare/master...MDL-26607_search_error

          Show
          Andrew Davis added a comment - repo: git://github.com/andyjdavis/moodle.git branch: MDL-26607 _search_error diff: https://github.com/andyjdavis/moodle/compare/master...MDL-26607_search_error
          Hide
          Andrew Davis added a comment -

          PULL-455

          Hi Vadim. If you are seeing incorrect behaviour please go and open a tracker issue about that specific issue and I will get it fixed

          Show
          Andrew Davis added a comment - PULL-455 Hi Vadim. If you are seeing incorrect behaviour please go and open a tracker issue about that specific issue and I will get it fixed
          Hide
          Andrew Davis added a comment -

          Noticed MDL-26836 while fixing this issue.

          Show
          Andrew Davis added a comment - Noticed MDL-26836 while fixing this issue.
          Hide
          Helen Foster added a comment -

          Andrew, thanks for fixing this issue.

          Show
          Helen Foster added a comment - Andrew, thanks for fixing this issue.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: