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

XMLDB check defaults returns false warnings

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Setup

      • You'll need a moodle instance using MySQL
      • You'll need to have some data in your site, for example creating a question with a defaultmark. This bug is also present in other tables like grade_items, question_attempts

      Test

      1. Log in as admin.
      2. Go to Site administration > Development > XMLDB editor
      3. Click [Check Defaults] and click Yes to start.
      4. Make sure all tables and fields return a OK status
      Show
      Setup You'll need a moodle instance using MySQL You'll need to have some data in your site, for example creating a question with a defaultmark. This bug is also present in other tables like grade_items, question_attempts Test Log in as admin. Go to Site administration > Development > XMLDB editor Click [Check Defaults] and click Yes to start. Make sure all tables and fields return a OK status
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull from Repository:
    • Pull 3.8 Branch:
    • Pull 3.9 Branch:
    • Pull Master Branch:
      MDL-63252-master
    • Story Points:
      0
    • Sprint:
      International 4.0 - Sprint 2, International 4.0 - Sprint 3

      Description

      Hi,

      When we use tool "Site administration / Development / XMLDB editor / Check Defaults" , it returns false warnings with some integer values.

      Sample :

      • Table: question. Field: defaultmark, Expected '1' Actual '1.0000000'
      • Table: question_answers. Field: fraction, Expected '0' Actual '0.0000000'
      • Table: question_attempts. Field: maxfraction, Expected '1' Actual '1.0000000'
      • Table: grade_items. Field: grademax, Expected '100' Actual '100.00000'
      • .....

      This problem is not present in an old version of Moodle (3.1.5)

      After searching in source, I found a difference in file
      $WWWROOT/admin/tool/xmldb/actions/check_defaults/check_defaults.class.php (line 97)

      In Moodle 3.5 , the test is : 

      if ($physicaldefault !== $xmldbdefault) {

      In Moodle 3.1 it was:

      if ($physicaldefault != $xmldbdefault) {

      I suppose that the problem comes from the test
      " != " tests only the value , " !== " tests the value and type

       

      I try to change " !== " to " != " in my Moodle 3.5 and get no warnings

      Thanks a lot

        Attachments

        1. errors.png
          errors.png
          47 kB
        2. image-2020-07-30-11-30-27-102.png
          image-2020-07-30-11-30-27-102.png
          127 kB
        3. image-2020-08-25-11-00-23-852.png
          image-2020-08-25-11-00-23-852.png
          30 kB
        4. maybe-fix-for-mdl63252.patch
          1 kB
        5. moodle_check_default_mysql.png
          moodle_check_default_mysql.png
          25 kB
        6. moodle_check_default_pg.png
          moodle_check_default_pg.png
          14 kB
        7. moodle_check_default_pg-1.png
          moodle_check_default_pg-1.png
          14 kB
        8. xmldb_error.png
          xmldb_error.png
          67 kB

          Issue Links

            Activity

              People

              Assignee:
              lameze Simey Lameze
              Reporter:
              uha Bruno Malaval
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              7 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 4 hours, 12 minutes
                  1d 4h 12m