Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-45323

grade_get_grade_items_for_activity gets error reading from database where modname is not set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.5.7, 2.6.4, 2.7.1
    • 2.4.9, 2.5.5, 2.6.2, STABLE backlog
    • Enrolments
    • Any
    • MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • MDL-45323-master
    • Easy
    • Hide
      • Run the unit test:
        vendor/bin/phpunit grade/tests/querylib_test.php
      • Make sure it pass, and you don't receive this message:

        1) core_grade_querylib_testcase::test_grade_get_grade_items_for_activity
        dml_read_exception: Error reading from database (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 'WHERE cm.id = '1' AND md.id = cm.module' at line 4
        SELECT cm.*, m.name, md.name as modname
                                            FROM phpu_course_modules cm,
                                                 phpu_modules md,
                                           WHERE cm.id = ? AND md.id = cm.module
        [array (
          0 => '1',
        )])
        

      Show
      Run the unit test: vendor/bin/phpunit grade/tests/querylib_test.php Make sure it pass, and you don't receive this message: 1) core_grade_querylib_testcase::test_grade_get_grade_items_for_activity dml_read_exception: Error reading from database (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 'WHERE cm.id = '1' AND md.id = cm.module' at line 4 SELECT cm.*, m.name, md.name as modname FROM phpu_course_modules cm, phpu_modules md, WHERE cm.id = ? AND md.id = cm.module [array ( 0 => '1', )])

      In grade/querylib.php function grade_get_grade_items_for_activity

      When it is called with $cm without modname it gets error reading from database where modname is not set.

      This is caused by the malformed SQL on line 257.

      Patch https://github.com/moodle/moodle/pull/90/files

      The same patch can be applied in all affected versions

            lameze Simey Lameze
            pferre22 Pau Ferrer
            Adrian Greeve Adrian Greeve
            Damyon Wiese Damyon Wiese
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.