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

XMLDB check defaults returns false warnings

    XMLWordPrintable

Details

    • MySQL
    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MDL-63252-master
    • 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
    • 0
    • 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. xmldb_error.png
          xmldb_error.png
          67 kB
        2. maybe-fix-for-mdl63252.patch
          1 kB
        3. moodle_check_default_mysql.png
          moodle_check_default_mysql.png
          25 kB
        4. moodle_check_default_pg.png
          moodle_check_default_pg.png
          14 kB
        5. moodle_check_default_pg-1.png
          moodle_check_default_pg-1.png
          14 kB
        6. image-2020-07-30-11-30-27-102.png
          image-2020-07-30-11-30-27-102.png
          127 kB
        7. image-2020-08-25-11-00-23-852.png
          image-2020-08-25-11-00-23-852.png
          30 kB
        8. errors.png
          errors.png
          47 kB

        Issue Links

          Activity

            People

              lameze Simey Lameze
              uha Bruno Malaval
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Janelle Barcega Janelle Barcega
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              7 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                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