Uploaded image for project: '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
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Messages
    • Labels:

      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()

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              tsala Helen Foster added a comment -

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

              Show
              tsala Helen Foster added a comment - This problem is also affecting moodle.org, as reported by Vadim Dvorovenko in MDLSITE-1232 .
              Hide
              vadimon 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
              vadimon 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
              andyjdavis 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
              andyjdavis 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
              andyjdavis 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
              andyjdavis 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
              andyjdavis Andrew Davis added a comment -

              Noticed MDL-26836 while fixing this issue.

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

              Andrew, thanks for fixing this issue.

              Show
              tsala 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:
                    Fix Release Date:
                    5/May/11